From 7caa9f741f04d0573b17067d5530f49913885c83 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 3 Mar 2014 15:52:12 -0500 Subject: [PATCH] Have sockapi stay alive through as-yet uncaught circumstances Previously, the client would be left hanging. Correct that by keeping the session alive and notifying the client of the unexpected condition. --- confluent/sockapi.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/confluent/sockapi.py b/confluent/sockapi.py index 0a2e5f9b..c4f47d0a 100644 --- a/confluent/sockapi.py +++ b/confluent/sockapi.py @@ -71,7 +71,14 @@ def sessionhdl(connection, authname): tlvdata.send_tlvdata(connection, {'authpassed': 1}) request = tlvdata.recv_tlvdata(connection) while request is not None: - process_request(connection, request, cfm, authdata) + try: + process_request(connection, request, cfm, authdata) + except: + import traceback + traceback.print_exc() + tlvdata.send_tlvdata(connection, {'errorcode': 500, + 'error': 'Unexpected error'}) + tlvdata.send_tlvdata(connection, {'_requestdone': 1}) request = tlvdata.recv_tlvdata(connection)