2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-14 19:57:50 +00:00

Have socket api gracefully handle client disconnect

When client disconnected, an unsightly trace was incurred.
Properly handle that particular scenario and proceed as intended.
This commit is contained in:
Jarrod Johnson 2014-03-03 16:03:10 -05:00
parent 7caa9f741f
commit 7595984cb9

View File

@ -27,6 +27,8 @@ def send_tlvdata(handle, data):
def recv_tlvdata(handle):
tl = handle.recv(4)
if len(tl) == 0:
return None
tl = struct.unpack("!I", tl)[0]
if tl & 0b10000000000000000000000000000000:
raise Exception("Protocol Violation, reserved bit set")