Loading sjrpc/core/rpcconnection.py +12 −2 Original line number Diff line number Diff line Loading @@ -211,7 +211,7 @@ class RpcConnection(object): err = {'exception': error, 'message': message} self._send_response(msg_id, error=err) def call(self, method_name, *args, **kwargs): #TODO: timeout def call(self, method_name, *args, **kwargs): ''' Make a new remote call on the peer. Loading @@ -227,6 +227,12 @@ class RpcConnection(object): didnt respond. ''' if '_timeout' in kwargs: timeout = kwargs['_timeout'] del kwargs['_timeout'] else: timeout = None # Send the call to the peer: msg_id = self._send_call(method_name, *args, **kwargs) Loading @@ -235,7 +241,11 @@ class RpcConnection(object): 'event': threading.Event()} # Wait for the response: self._calls[msg_id]['event'].wait() self._calls[msg_id]['event'].wait(timeout) # Check if timeout occured: if not self._calls[msg_id]['event'].is_set(): raise RpcError('TimeoutError', 'remote method timeout') # Check if error occured while execution: if self._calls[msg_id]['error'] is not None: Loading Loading
sjrpc/core/rpcconnection.py +12 −2 Original line number Diff line number Diff line Loading @@ -211,7 +211,7 @@ class RpcConnection(object): err = {'exception': error, 'message': message} self._send_response(msg_id, error=err) def call(self, method_name, *args, **kwargs): #TODO: timeout def call(self, method_name, *args, **kwargs): ''' Make a new remote call on the peer. Loading @@ -227,6 +227,12 @@ class RpcConnection(object): didnt respond. ''' if '_timeout' in kwargs: timeout = kwargs['_timeout'] del kwargs['_timeout'] else: timeout = None # Send the call to the peer: msg_id = self._send_call(method_name, *args, **kwargs) Loading @@ -235,7 +241,11 @@ class RpcConnection(object): 'event': threading.Event()} # Wait for the response: self._calls[msg_id]['event'].wait() self._calls[msg_id]['event'].wait(timeout) # Check if timeout occured: if not self._calls[msg_id]['event'].is_set(): raise RpcError('TimeoutError', 'remote method timeout') # Check if error occured while execution: if self._calls[msg_id]['error'] is not None: Loading