remove race condition

This commit is contained in:
benoitc 2010-03-04 19:23:37 +01:00
parent 6ca87c5cf4
commit 8622604f44
2 changed files with 2 additions and 8 deletions

View File

@ -135,6 +135,7 @@ class TeeInput(object):
def _tee(self, length): def _tee(self, length):
""" fetch partial body""" """ fetch partial body"""
while True: while True:
print len(self._buf)
chunk, self.buf = self.parser.filter_body(self.buf) chunk, self.buf = self.parser.filter_body(self.buf)
if chunk: if chunk:
self.tmp.write(chunk) self.tmp.write(chunk)

View File

@ -90,14 +90,7 @@ def close(sock):
pass pass
def read_partial(sock, length, buf=None): def read_partial(sock, length, buf=None):
if buf is not None: tmp_buf = skt.recv(length)
if len(buf) >= length:
return buf
else:
length = length - len(buf)
tmp_buf = sock.recv(length)
if not buf: if not buf:
return tmp_buf return tmp_buf