Loading sjrpc/core/protocols/tunnel.py +23 −2 Original line number Diff line number Diff line Loading @@ -54,7 +54,20 @@ class TunnelProtocol(Protocol): Handle data coming from the endpoint socket and push it through the sjRpc tunnel. ''' try: read = self._endpoint.recv(self._ok_to_send) except (IOError, socket.error) as err: if err.errno in self.connection.NONBLOCKING_ERRORS: return else: self.close() return # Empty read means the connection has been closed on other side: if not read: self.close() return self._ok_to_send -= len(read) self.send(read) if not self._ok_to_send: Loading @@ -69,7 +82,15 @@ class TunnelProtocol(Protocol): This method is also responsible of asking more data to the peer when the incoming buffer is empty. ''' try: sent = self._endpoint.send(self._from_tun_to_endpoint_buf) except (IOError, socket.error) as err: if err.errno in self.connection.NONBLOCKING_ERRORS: return else: self.close() return self._from_tun_to_endpoint_buf = self._from_tun_to_endpoint_buf[sent:] self._asked -= sent if self._asked < TunnelProtocol.GET_SIZE * 2: Loading Loading
sjrpc/core/protocols/tunnel.py +23 −2 Original line number Diff line number Diff line Loading @@ -54,7 +54,20 @@ class TunnelProtocol(Protocol): Handle data coming from the endpoint socket and push it through the sjRpc tunnel. ''' try: read = self._endpoint.recv(self._ok_to_send) except (IOError, socket.error) as err: if err.errno in self.connection.NONBLOCKING_ERRORS: return else: self.close() return # Empty read means the connection has been closed on other side: if not read: self.close() return self._ok_to_send -= len(read) self.send(read) if not self._ok_to_send: Loading @@ -69,7 +82,15 @@ class TunnelProtocol(Protocol): This method is also responsible of asking more data to the peer when the incoming buffer is empty. ''' try: sent = self._endpoint.send(self._from_tun_to_endpoint_buf) except (IOError, socket.error) as err: if err.errno in self.connection.NONBLOCKING_ERRORS: return else: self.close() return self._from_tun_to_endpoint_buf = self._from_tun_to_endpoint_buf[sent:] self._asked -= sent if self._asked < TunnelProtocol.GET_SIZE * 2: Loading