From 736fd828fa25cff4765cd2829c321597234b43e5 Mon Sep 17 00:00:00 2001 From: Antoine Millet Date: Tue, 4 Oct 2011 11:09:18 +0200 Subject: [PATCH] Pythonization + comments --- sjrpc/core/rpcconnection.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sjrpc/core/rpcconnection.py b/sjrpc/core/rpcconnection.py index 21e06bb..9c1c4b5 100644 --- a/sjrpc/core/rpcconnection.py +++ b/sjrpc/core/rpcconnection.py @@ -193,7 +193,6 @@ class RpcConnection(object): handler. ''' # Try to received remaining data from the socket: - if buf == '': try: buf = self._sock.recv(self._remains) except socket.error as err: @@ -205,9 +204,12 @@ class RpcConnection(object): return else: raise + if not buf: + # Empty data on non-blocking socket means that the connection + # has been closed: self.shutdown() - self._remains -= len(buf) + self._remains -= len(buf) if self._proto_receiving is None: self._inbound_buffer += buf if self._remains == 0: -- GitLab