Merge pull request #3631 from lovedboy/master

little modification  in consume_socket_content
This commit is contained in:
Cory Benfield
2016-10-21 09:58:30 +01:00
committed by GitHub
+5 -5
View File
@@ -8,17 +8,17 @@ import select
def consume_socket_content(sock, timeout=0.5):
chunks = 65536
content = b''
more_to_read = select.select([sock], [], [], timeout)[0]
while more_to_read:
while True:
more_to_read = select.select([sock], [], [], timeout)[0]
if not more_to_read:
break
new_content = sock.recv(chunks)
if not new_content:
break
content += new_content
# stop reading if no new data is received for a while
more_to_read = select.select([sock], [], [], timeout)[0]
return content