diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-07-30 11:58:29 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-07-30 12:02:42 +1200 |
commit | 5b08703fa8338407af063652658e7f570a2ec0f8 (patch) | |
tree | 3d619b149176c697b2ccf08cf9b3e952542c78c7 /libpathod/pathod.py | |
parent | b1ac4245c81c07fb6b0e014a3cc8046f637d8aff (diff) | |
download | mitmproxy-5b08703fa8338407af063652658e7f570a2ec0f8.tar.gz mitmproxy-5b08703fa8338407af063652658e7f570a2ec0f8.tar.bz2 mitmproxy-5b08703fa8338407af063652658e7f570a2ec0f8.zip |
Handle disconnects on flush.
Diffstat (limited to 'libpathod/pathod.py')
-rw-r--r-- | libpathod/pathod.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libpathod/pathod.py b/libpathod/pathod.py index 0ae32c47..7cb7d604 100644 --- a/libpathod/pathod.py +++ b/libpathod/pathod.py @@ -136,17 +136,7 @@ class PathodHandler(tcp.BaseHandler): return while not self.finished: - try: - if not self.handle_request(): - return - except tcp.NetLibDisconnect: # pragma: no cover - self.info("Disconnect") - self.server.add_log( - dict( - type = "error", - msg = "Disconnect" - ) - ) + if not self.handle_request(): return @@ -211,8 +201,18 @@ class Pathod(tcp.TCPServer): def handle_connection(self, request, client_address): h = PathodHandler(request, client_address, self) - h.handle() - h.finish() + try: + h.handle() + h.finish() + except tcp.NetLibDisconnect: # pragma: no cover + h.info("Disconnect") + self.add_log( + dict( + type = "error", + msg = "Disconnect" + ) + ) + return def add_log(self, d): if not self.noapi: |