From 8622604f4476a20c4a68255644a3d702e5748a67 Mon Sep 17 00:00:00 2001 From: benoitc Date: Thu, 4 Mar 2010 19:23:37 +0100 Subject: [PATCH] remove race condition --- gunicorn/http/tee.py | 1 + gunicorn/util.py | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/gunicorn/http/tee.py b/gunicorn/http/tee.py index 57291775..7940968a 100644 --- a/gunicorn/http/tee.py +++ b/gunicorn/http/tee.py @@ -135,6 +135,7 @@ class TeeInput(object): def _tee(self, length): """ fetch partial body""" while True: + print len(self._buf) chunk, self.buf = self.parser.filter_body(self.buf) if chunk: self.tmp.write(chunk) diff --git a/gunicorn/util.py b/gunicorn/util.py index f4f81066..3f3da4fa 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -90,14 +90,7 @@ def close(sock): pass def read_partial(sock, length, buf=None): - if buf is not None: - if len(buf) >= length: - return buf - else: - length = length - len(buf) - - tmp_buf = sock.recv(length) - + tmp_buf = skt.recv(length) if not buf: return tmp_buf