From 0a7d73bc837632a72e8c3cf4b92ae408788593c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tarjei=20Hus=C3=B8y?= Date: Thu, 2 Jun 2016 08:56:04 -0700 Subject: [PATCH] Run initiation under try/except Ensures that connection is closed if errors occur here. --- postgres_mitm.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/postgres_mitm.py b/postgres_mitm.py index bc2726d..6504f1d 100644 --- a/postgres_mitm.py +++ b/postgres_mitm.py @@ -147,10 +147,9 @@ class ClientConnection(threading.Thread): def run(self): - self.initiate_client_and_server_connections() - _logger.debug('Initiated') try: - _logger.debug('Using select to wait for data') + self.initiate_client_and_server_connections() + _logger.debug('Initiated') while not self.stopped: timeout = 0 sockets = [self.server_socket, self.socket]