mirror of
https://github.com/xcat2/confluent.git
synced 2025-01-17 21:23:18 +00:00
Client behavior fix when server sends 0 data
If the server sends zero data, client could hang as it does recv(0). Fix this by returning None in that scenario.
This commit is contained in:
parent
a83583a56d
commit
be8d82c6c1
@ -76,6 +76,8 @@ def recv(handle):
|
||||
# 4 byte tlv
|
||||
dlen = tl & 16777215 # grab lower 24 bits
|
||||
datatype = (tl & 2130706432) >> 24 # grab 7 bits from near beginning
|
||||
if dlen == 0:
|
||||
return None
|
||||
data = handle.recv(dlen)
|
||||
while len(data) < dlen:
|
||||
ndata = handle.recv(dlen - len(data))
|
||||
|
Loading…
x
Reference in New Issue
Block a user