From 10b744ee0810b56143d5dbca79eaaca94ab0e21e Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 28 Jul 2013 10:50:25 +1200 Subject: Properly terminate SSL server connections. Before, we had dangling SSL server connections causing resource exhaustion. I believe this fixe #144 and #153 --- libmproxy/proxy.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libmproxy') diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index a7d8d2ba..79025a34 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -58,7 +58,6 @@ class ServerConnection(tcp.TCPClient): self.tcp_setup_timestamp = None self.ssl_setup_timestamp = None - def connect(self): tcp.TCPClient.connect(self) self.tcp_setup_timestamp = time.time() @@ -179,6 +178,8 @@ class ProxyHandler(tcp.BaseHandler): return self.server_conn def del_server_connection(self): + if self.server_conn: + self.server_conn.terminate() self.server_conn = None def handle(self): @@ -188,6 +189,7 @@ class ProxyHandler(tcp.BaseHandler): while self.handle_request(cc) and not cc.close: pass cc.close = True + self.del_server_connection() cd = flow.ClientDisconnect(cc) self.log( -- cgit v1.2.3