diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2015-06-08 15:57:29 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2015-06-08 15:57:29 +1200 |
commit | 97fdb9ef0ca357265e77857dadab4f7dad4e5bf5 (patch) | |
tree | c516f35da5f1ce5f673eef364468990b2faf6a8c /libpathod/pathoc.py | |
parent | 3ad73dfb5bf3f027f864af409b82320554ee9144 (diff) | |
download | mitmproxy-97fdb9ef0ca357265e77857dadab4f7dad4e5bf5.tar.gz mitmproxy-97fdb9ef0ca357265e77857dadab4f7dad4e5bf5.tar.bz2 mitmproxy-97fdb9ef0ca357265e77857dadab4f7dad4e5bf5.zip |
More timeout improvements
Diffstat (limited to 'libpathod/pathoc.py')
-rw-r--r-- | libpathod/pathoc.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py index fcb254c0..ca21a423 100644 --- a/libpathod/pathoc.py +++ b/libpathod/pathoc.py @@ -120,7 +120,8 @@ class WebsocketFrameReader(threading.Thread): if self.ws_read_limit == 0: return r, _, x = select.select([self.rfile], [], [], 0.05) - if not r and time.time() - starttime > self.timeout: + delta = time.time() - starttime + if not r and self.timeout and delta > self.timeout: return try: self.terminate.get_nowait() @@ -233,8 +234,6 @@ class Pathoc(tcp.TCPClient): an HTTP CONNECT request. """ tcp.TCPClient.connect(self) - if self.timeout: - self.settimeout(self.timeout) if connect_to: self.http_connect(connect_to) self.sslinfo = None @@ -254,6 +253,8 @@ class Pathoc(tcp.TCPClient): ) if showssl: print >> fp, str(self.sslinfo) + if self.timeout: + self.settimeout(self.timeout) def _resp_summary(self, resp): return "<< %s %s: %s bytes" % ( |