[tor-commits] [flashproxy/master] Patching listen_socket to squelch AttributeError on Windows.
dcf at torproject.org
dcf at torproject.org
Sun Oct 21 07:31:51 UTC 2012
commit b1be6df3021c609b92982736a1cbc6b6e9a4e5a8
Author: Alexandre Allaire <aallai at wpa149034.wireless.mcgill.ca>
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)
More information about the tor-commits
mailing list