From be8d82c6c1bfab238ca32543dcca61f7b68cf121 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 21 Oct 2015 10:22:49 -0400 Subject: [PATCH] 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. --- confluent_client/confluent/tlvdata.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/confluent_client/confluent/tlvdata.py b/confluent_client/confluent/tlvdata.py index 4da3ae38..356a4ee0 100644 --- a/confluent_client/confluent/tlvdata.py +++ b/confluent_client/confluent/tlvdata.py @@ -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))