Commit 90ca6796 authored by Antoine Millet's avatar Antoine Millet
Browse files

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.:
parent e239e1e1
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -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():
            if 'event' in call:
                call['error'] = {'exception': 'RpcError',
        for cid, call in self._calls.iteritems():
            err = {'exception': 'RpcError',
                   'message': 'Connection reset by peer'}
            if 'event' in call:
                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: