From a6c3a9804ec9c460250cc922e84c05608d3ffb61 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sun, 25 Oct 2009 20:25:11 +0100 Subject: SocketFileWrapper from forkpool contained more bugs --- wsgitools/scgi/forkpool.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'wsgitools/scgi/forkpool.py') 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) -- cgit v1.2.3