Ticket #7147: ticket#7147.patch

File ticket#7147.patch, 1.2 KB (added by cypherpunks, 7 years ago)

Patch catches AttributeError and passes. Comment provides short explanation and links to Python bug list.

  • flashproxy-client

    From 36187b54a0ec2ffc28f98eeed7e51109735adcdf Mon Sep 17 00:00:00 2001
    From: Alexandre Allaire <aallai@wpa149034.wireless.mcgill.ca>
    Date: Fri, 19 Oct 2012 15:50:02 -0400
    Subject: [PATCH] Patching listen_socket to squelch AttributeError on Windows.
    
    ---
     flashproxy-client |    9 ++++++++-
     1 file changed, 8 insertions(+), 1 deletion(-)
    
    diff --git a/flashproxy-client b/flashproxy-client
    index 64e01d9..cc9d95a 100755
    a b def listen_socket(addr): 
    461461        # example, "::" will listen on both "::" and "0.0.0.0", and "::1" will
    462462        # listen on both "::1" and "127.0.0.1". See
    463463        # https://trac.torproject.org/projects/tor/ticket/4760.
    464         s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 1)
     464        # Python2.7.3 on Windows does not define IPPROTO_IPV6,
     465        # see http://bugs.python.org/issue6926.
     466        # Default behavior on Windows is to listen on IPv6 addresses only,
     467        # so we can skip the setsockopt call.
     468        try:
     469            s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 1)
     470        except AttributeError:
     471            pass
    465472    s.bind(addr)
    466473    s.listen(10)
    467474    s.setblocking(0)