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

dcf at torproject.org dcf at torproject.org
Sun Aug 21 09:40:32 UTC 2011


commit 8d677ae0584524bbaa9a54cf953afd9291e72203
Author: David Fifield <david at bamsoftware.com>
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



More information about the tor-commits mailing list