diff options
author | Helmut Grohne <helmut@subdivi.de> | 2008-07-09 21:34:57 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2008-07-09 21:34:57 +0200 |
commit | 8ed010e474ef1fc5d2c1ec998741d62e2bbfe56f (patch) | |
tree | 70c8186f6964ca669ed819ac692a0b5accb5a662 /wsgitools/scgi | |
parent | 37c1ac9cb22e364ffafbc730a311b1d271f97522 (diff) | |
download | wsgitools-8ed010e474ef1fc5d2c1ec998741d62e2bbfe56f.tar.gz |
speed up receiving data in forkpool
Diffstat (limited to 'wsgitools/scgi')
-rw-r--r-- | wsgitools/scgi/forkpool.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/wsgitools/scgi/forkpool.py b/wsgitools/scgi/forkpool.py index 3597f08..107b31a 100644 --- a/wsgitools/scgi/forkpool.py +++ b/wsgitools/scgi/forkpool.py @@ -66,12 +66,19 @@ class SocketFileWrapper: except socket.error: break return "".join(retl) - while len(self.buff) < size: + datalist = [self.buff] + datalen = len(self.buff) + while datalen < size: try: - data = self._recv(min(4096, size - len(self.buff))) + data = self._recv(min(4096, size - datalen)) except socket.error: break - self.buff += data + if not data: + break + datalist.append(data) + datalen += len(data) + self.buff = "".join(datalist) + if size <= len(self.buff): ret, self.buff = self.buff[:size], self.buff[size:] return ret |