From efe11a0782a668b4310849f7696cc89004d82f45 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Thu, 27 Jan 2011 13:32:24 +1300 Subject: Kill deadlock that sometimes occurred on shutdown. --- libmproxy/proxy.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'libmproxy/proxy.py') diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index f3b9fe53..5e8da3e4 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -85,7 +85,6 @@ class Request(controller.Msg): self.connection = connection self.host, self.port, self.scheme = host, port, scheme self.method, self.path, self.headers, self.content = method, path, headers, content - self.kill = False controller.Msg.__init__(self) def get_state(self): @@ -161,7 +160,6 @@ class Response(controller.Msg): self.request = request self.code, self.proto, self.msg = code, proto, msg self.headers, self.content = headers, content - self.kill = False controller.Msg.__init__(self) def get_state(self): @@ -341,13 +339,13 @@ class ProxyHandler(SocketServer.StreamRequestHandler): try: request = self.read_request(bc) request = request.send(self.mqueue) - if request.kill: + if request is None: self.finish() return server = ServerConnection(request) response = server.read_response() response = response.send(self.mqueue) - if response.kill: + if response is None: server.terminate() self.finish() return @@ -405,6 +403,7 @@ class ProxyHandler(SocketServer.StreamRequestHandler): self.wfile.flush() def terminate(self, connection, wfile, rfile): + self.request.close() try: if not getattr(wfile, "closed", False): wfile.flush() -- cgit v1.2.3