Commit c80d8def authored by Antoine Millet's avatar Antoine Millet

Outbound buffer is now protected with a lock.

parent 87476958
......@@ -103,8 +103,9 @@ class RpcConnection(object):
sent = self._sock.send(data)
data = data[sent:]
if not len(self._outbound_buffer):
self._manager.nothing_to_write(self)
with self._outbound_buffer:
if not len(self._outbound_buffer):
self._manager.nothing_to_write(self)
def receive(self):
'''
......@@ -143,8 +144,9 @@ class RpcConnection(object):
logging.debug('Sending: %s' % message)
json_msg = json.dumps(message)
size = struct.pack('!L', len(json_msg))
self._outbound_buffer.push(size + json_msg)
self._manager.data_to_write(self)
with self._outbound_buffer:
self._outbound_buffer.push(size + json_msg)
self._manager.data_to_write(self)
def _send_call(self, method_name, *args, **kwargs):
'''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment