Commit 002264c0 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Code cleanup

parent 8ba1705c
......@@ -139,19 +139,17 @@ def recvn(sock, n):
"""
Keep receiving data from `sock' until exactly `n' bytes have been read.
"""
left = n
data = ''
while left > 0:
received = sock.recv(left)
while len(data) < n:
received = sock.recv(n - len(data))
if not len(received):
raise SocketClosed()
data += received
left -= len(received)
return received
return data
def mask(key, original):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment