From eafa5566c27ec321131a9d83d85dab512aae7a37 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 30 Jul 2012 11:30:31 +1200 Subject: Handle disconnects on flush. --- netlib/tcp.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'netlib/tcp.py') 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): """ -- cgit v1.2.3