Make recv_data less greedy so it doesn't eat other packets
This commit is contained in:
parent
13f28d31fa
commit
3b87b2c56c
1 changed files with 2 additions and 2 deletions
|
@ -198,7 +198,7 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
|
||||||
data = b""
|
data = b""
|
||||||
vvvv("in recv_data(), waiting for the header")
|
vvvv("in recv_data(), waiting for the header")
|
||||||
while len(data) < header_len:
|
while len(data) < header_len:
|
||||||
d = self.request.recv(1024)
|
d = self.request.recv(header_len - len(data))
|
||||||
if not d:
|
if not d:
|
||||||
vvv("received nothing, bailing out")
|
vvv("received nothing, bailing out")
|
||||||
return None
|
return None
|
||||||
|
@ -208,7 +208,7 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
|
||||||
data = data[header_len:]
|
data = data[header_len:]
|
||||||
vvvv("data received so far (expecting %d): %d" % (data_len,len(data)))
|
vvvv("data received so far (expecting %d): %d" % (data_len,len(data)))
|
||||||
while len(data) < data_len:
|
while len(data) < data_len:
|
||||||
d = self.request.recv(1024)
|
d = self.request.recv(data_len - len(data))
|
||||||
if not d:
|
if not d:
|
||||||
vvv("received nothing, bailing out")
|
vvv("received nothing, bailing out")
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue