diff --git a/src/class_outgoingSynSender.py b/src/class_outgoingSynSender.py index af9e5dd2..f7074b65 100644 --- a/src/class_outgoingSynSender.py +++ b/src/class_outgoingSynSender.py @@ -59,7 +59,24 @@ class outgoingSynSender(threading.Thread): address_family = socket.AF_INET else: address_family = socket.AF_INET6 - sock = socks.socksocket(address_family, socket.SOCK_STREAM) + try: + sock = socks.socksocket(address_family, socket.SOCK_STREAM) + except: + """ + The line can fail on Windows systems which aren't + 64-bit compatiable: + File "C:\Python27\lib\socket.py", line 187, in __init__ + _sock = _realsocket(family, type, proto) + error: [Errno 10047] An address incompatible with the requested protocol was used + + So let us remove the offending address from our knownNodes file. + """ + shared.knownNodesLock.acquire() + del shared.knownNodes[self.streamNumber][peer] + shared.knownNodesLock.release() + with shared.printLock: + print 'deleting ', peer, 'from shared.knownNodes because it caused a socks.socksocket exception. We must not be 64-bit compatible.' + continue # This option apparently avoids the TIME_WAIT state so that we # can rebind faster sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) diff --git a/src/class_receiveDataThread.py b/src/class_receiveDataThread.py index f52c0b8b..127f18a4 100644 --- a/src/class_receiveDataThread.py +++ b/src/class_receiveDataThread.py @@ -622,6 +622,10 @@ class receiveDataThread(threading.Thread): continue else: hostFromAddrMessage = socket.inet_ntop(socket.AF_INET6, fullHost) + if hostFromAddrMessage == "": + # This can happen on Windows systems which are not 64-bit compatible + # so let us drop the IPv6 address. + continue if not self._checkIPv6Address(fullHost, hostFromAddrMessage): continue timeSomeoneElseReceivedMessageFromThisNode, = unpack('>Q', data[lengthOfNumberOfAddresses + (