diff options
Diffstat (limited to 'wsgitools/scgi/forkpool.py')
-rw-r--r-- | wsgitools/scgi/forkpool.py | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/wsgitools/scgi/forkpool.py b/wsgitools/scgi/forkpool.py index 257a29e..a0b4139 100644 --- a/wsgitools/scgi/forkpool.py +++ b/wsgitools/scgi/forkpool.py @@ -20,22 +20,11 @@ class SocketFileWrapper: self.buff = "" self.toread = toread - def _recv(self, size=None): + def _recv(self, size=4096): """ internal method for receiving and counting incoming data @raise socket.error: """ - if size is None: - try: - data = self.sock.recv(4096) - except socket.error, why: - if why[0] in (errno.ECONNRESET, errno.ENOTCONN, - errno.ESHUTDOWN): - data = "" - else: - raise - self.toread -= len(data) - return data try: data = self.sock.recv(size) except socket.error, why: @@ -68,12 +57,14 @@ class SocketFileWrapper: retl = [] data = self.buff self.buff = "" - while data: + while True: retl.append(data) try: data = self._recv() except socket.error: break + if not data: + break return "".join(retl) datalist = [self.buff] datalen = len(self.buff) |