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

[tor-commits] [flashproxy/master] Patching listen_socket to squelch AttributeError on Windows.



commit b1be6df3021c609b92982736a1cbc6b6e9a4e5a8
Author: Alexandre Allaire <aallai@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date:   Fri Oct 19 15:50:02 2012 -0400

    Patching listen_socket to squelch AttributeError on Windows.
---
 flashproxy-client |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/flashproxy-client b/flashproxy-client
index 64e01d9..cc9d95a 100755
--- a/flashproxy-client
+++ b/flashproxy-client
@@ -461,7 +461,14 @@ def listen_socket(addr):
         # example, "::" will listen on both "::" and "0.0.0.0", and "::1" will
         # listen on both "::1" and "127.0.0.1". See
         # https://trac.torproject.org/projects/tor/ticket/4760.
-        s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 1)
+        # Python2.7.3 on Windows does not define IPPROTO_IPV6,
+        # see http://bugs.python.org/issue6926.
+        # Default behavior on Windows is to listen on IPv6 addresses only,
+        # so we can skip the setsockopt call.
+        try:
+            s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 1)
+        except AttributeError:
+            pass
     s.bind(addr)
     s.listen(10)
     s.setblocking(0)



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