Merge pull request #139 from smurfix/fixes

Close connection when flush fails
This commit is contained in:
Aldo Cortesi 2013-07-01 17:36:33 -07:00
commit 1f029306d6
1 changed files with 4 additions and 1 deletions

View File

@ -88,6 +88,9 @@ class ServerConnection(tcp.TCPClient):
def terminate(self):
try:
self.wfile.flush()
except IOError:
pass
try:
self.connection.close()
except IOError:
pass
@ -213,7 +216,7 @@ class ProxyHandler(tcp.BaseHandler):
return
else:
request_reply = self.channel.ask(request)
if request_reply == KILL:
if request_reply is None or request_reply == KILL:
return
elif isinstance(request_reply, flow.Response):
request = False