diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-07-30 11:30:31 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-07-30 11:30:31 +1200 |
commit | eafa5566c27ec321131a9d83d85dab512aae7a37 (patch) | |
tree | f8e8438972a5fb1fedc12ec65f4707d86bc36965 /netlib | |
parent | 4fb5d15f1480dd6ca86578aca2d0784bfef31dac (diff) | |
download | mitmproxy-eafa5566c27ec321131a9d83d85dab512aae7a37.tar.gz mitmproxy-eafa5566c27ec321131a9d83d85dab512aae7a37.tar.bz2 mitmproxy-eafa5566c27ec321131a9d83d85dab512aae7a37.zip |
Handle disconnects on flush.
Diffstat (limited to 'netlib')
-rw-r--r-- | netlib/tcp.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py index 7d3705da..e7bc79a8 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -48,8 +48,11 @@ class FileLike: return getattr(self.o, attr) def flush(self): - if hasattr(self.o, "flush"): - self.o.flush() + try: + if hasattr(self.o, "flush"): + self.o.flush() + except socket.error, v: + raise NetLibDisconnect(str(v)) def read(self, length): """ |