diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2014-03-02 16:47:10 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2014-03-02 16:47:10 +1300 |
commit | e381c0366863ae412547e16d67860137a6b89a32 (patch) | |
tree | 5bb778e9b63472180a18f168166889bf56b9f2c7 /netlib/tcp.py | |
parent | 7788391903ef67ed1e779560936d60402159f8f5 (diff) | |
download | mitmproxy-e381c0366863ae412547e16d67860137a6b89a32.tar.gz mitmproxy-e381c0366863ae412547e16d67860137a6b89a32.tar.bz2 mitmproxy-e381c0366863ae412547e16d67860137a6b89a32.zip |
Cleanups, tests, and no-cover directives for code sections we can't test.
Diffstat (limited to 'netlib/tcp.py')
-rw-r--r-- | netlib/tcp.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py index 23449baf..8f2ebdf0 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -2,6 +2,8 @@ import select, socket, threading, sys, time, traceback from OpenSSL import SSL import certutils +EINTR = 4 + SSLv2_METHOD = SSL.SSLv2_METHOD SSLv3_METHOD = SSL.SSLv3_METHOD SSLv23_METHOD = SSL.SSLv23_METHOD @@ -238,7 +240,7 @@ class SocketCloseMixin(object): #Section 4.2.2.13 of RFC 1122 tells us that a close() with any # pending readable data could lead to an immediate RST being sent. #http://ia600609.us.archive.org/22/items/TheUltimateSo_lingerPageOrWhyIsMyTcpNotReliable/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable.html - while self.connection.recv(4096): + while self.connection.recv(4096): # pragma: no cover pass self.connection.close() except (socket.error, SSL.Error, IOError): @@ -420,8 +422,8 @@ class TCPServer(object): while not self.__shutdown_request: try: r, w, e = select.select([self.socket], [], [], poll_interval) - except select.error, ex: - if ex[0] == 4: + except select.error, ex: # pragma: no cover + if ex[0] == EINTR: continue else: raise |