From 90ca6796485ceca7f56b59836b63c77e2a4a4ff1 Mon Sep 17 00:00:00 2001 From: Antoine Millet Date: Mon, 2 May 2011 10:33:35 +0200 Subject: [PATCH] Fixed a bug with dropped connections and async requests. When a connection is dropped, all "wait" operations of asynchronous calls are now released with an error message, exactly like synchronous calls.: --- sjrpc/core/rpcconnection.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sjrpc/core/rpcconnection.py b/sjrpc/core/rpcconnection.py index dbc791d..e8d3d04 100644 --- a/sjrpc/core/rpcconnection.py +++ b/sjrpc/core/rpcconnection.py @@ -396,12 +396,16 @@ class RpcConnection(object): logging.debug('Error while socket close: %s.', err) # Release all running calls from this connection: - for call in self._calls.values(): + for cid, call in self._calls.iteritems(): + err = {'exception': 'RpcError', + 'message': 'Connection reset by peer'} if 'event' in call: - call['error'] = {'exception': 'RpcError', - 'message': 'Connection reset by peer'} + call['error'] = err call['return'] = None call['event'].set() + else: + msg = {'id': cid, 'error': err, 'return': None} + self._manager.signal_arrival(msg) if callback is not None and not callable(callback): if self._handler is not None: -- GitLab