[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [flashproxy/master] Handle old-style socket.error in EPIPE handler.



commit 8d677ae0584524bbaa9a54cf953afd9291e72203
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Sun Aug 21 05:33:38 2011 -0400

    Handle old-style socket.error in EPIPE handler.
---
 facilitator.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/facilitator.py b/facilitator.py
index f7a4ba9..bea3957 100755
--- a/facilitator.py
+++ b/facilitator.py
@@ -319,7 +319,14 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
             try:
                 fn(self, *args)
             except socket.error, e:
-                if e.errno != errno.EPIPE:
+                try:
+                    err_num = e.errno
+                except AttributeError:
+                    # Before Python 2.6, exception can be a pair.
+                    err_num, errstr = e
+                except:
+                    raise
+                if err_num != errno.EPIPE:
                     raise
                 log(u"%s broken pipe" % format_addr(self.client_address))
         return ret

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits