Skip to content
Snippets Groups Projects
Commit c80d8def authored by Antoine Millet's avatar Antoine Millet
Browse files

Outbound buffer is now protected with a lock.

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