fix IPv6 issues under window 7 for file transfer. Fixes #4452, #7240

This commit is contained in:
Yann Leboulanger 2013-07-05 21:10:16 +02:00
parent 1d87b050b4
commit ba80ea181f
2 changed files with 4 additions and 2 deletions

View File

@ -166,6 +166,7 @@ class ProxyResolver:
self.state = S_FINISHED
def _on_connect_failure(self):
print 'connection failed: ' + self.host
self.state = S_FINISHED
self.host = None
self.port = 0

View File

@ -1373,9 +1373,10 @@ class Socks5Listener(IdleObject):
# Doesn't work under windows XP
if os.name == 'nt':
ver = os.sys.getwindowsversion()
if (ver[3], ver[0], ver[1]) == (2, 6, 0):
if (ver[3], ver[0]) == (2, 6): # Win Vista +
# 47 is socket.IPPROTO_IPV6
# 27 is socket.IPV6_V6ONLY under windows, but not defined ...
self._serv.setsockopt(socket.IPPROTO_IPV6, 27, 1)
self._serv.setsockopt(41, 27, 0)
# will fail when port as busy, or we don't have rights to bind
try:
self._serv.bind(ai[4])