right length

This commit is contained in:
benoitc 2010-03-04 18:58:27 +01:00
parent 77ea9ea78a
commit 6ca87c5cf4

View File

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