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

[tor-commits] [flashproxy/master] Catch socket errors for crossdomain- and SOCKS-pending too.



commit 9275698b268fd3c82d1cd8156569857438426490
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Tue Jul 12 08:36:08 2011 -0700

    Catch socket errors for crossdomain- and SOCKS-pending too.
---
 connector.py |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/connector.py b/connector.py
index bb86046..f85aeca 100755
--- a/connector.py
+++ b/connector.py
@@ -197,8 +197,12 @@ def handle_policy_request(fd):
     """Returns True iff the socket is still open and usable (wasn't a
     crossdomain request and wasn't closed."""
     log(u"handle_policy_request")
-    addr = fd.getpeername()
-    data = fd.recv(100)
+    try:
+        addr = fd.getpeername()
+        data = fd.recv(100)
+    except socket.error, e:
+        log(u"Socket error from crossdomain-pending: %s" % repr(str(e)))
+        return False
     if data == "<policy-file-request/>\0":
         log(u"Sending crossdomain policy to %s." % format_addr(addr))
         fd.sendall("""
@@ -251,8 +255,12 @@ def parse_socks_request(data):
 
 def handle_socks_request(fd):
     log(u"handle_socks_request")
-    addr = fd.getpeername()
-    data = fd.recv(100)
+    try:
+        addr = fd.getpeername()
+        data = fd.recv(100)
+    except socket.error, e:
+        log(u"Socket error from SOCKS-pending: %s" % repr(str(e)))
+        return False
     dest_addr = parse_socks_request(data)
     if dest_addr is None:
         # Error reply.



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