summaryrefslogtreecommitdiff
path: root/wsgitools/scgi/forkpool.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2009-10-25 20:25:11 +0100
committerHelmut Grohne <helmut@subdivi.de>2009-10-25 20:25:11 +0100
commita6c3a9804ec9c460250cc922e84c05608d3ffb61 (patch)
tree1945e4a1893e920d1a871cae504e319f090169d9 /wsgitools/scgi/forkpool.py
parenta9ccca793ab1f51561273bbcb38421b117cd507a (diff)
downloadwsgitools-a6c3a9804ec9c460250cc922e84c05608d3ffb61.tar.gz
SocketFileWrapper from forkpool contained more bugs
Diffstat (limited to 'wsgitools/scgi/forkpool.py')
-rw-r--r--wsgitools/scgi/forkpool.py17
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)