From 7595984cb9b80e0ca4a9090ab6589e8e80852b6b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 3 Mar 2014 16:03:10 -0500 Subject: [PATCH] Have socket api gracefully handle client disconnect When client disconnected, an unsightly trace was incurred. Properly handle that particular scenario and proceed as intended. --- confluent/common/tlvdata.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/confluent/common/tlvdata.py b/confluent/common/tlvdata.py index 1fc7327f..f61a9ef8 100644 --- a/confluent/common/tlvdata.py +++ b/confluent/common/tlvdata.py @@ -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")