Make SO_REUSEPORT optional

- apparently not available on Windows
This commit is contained in:
Peter Šurda 2017-05-29 11:30:56 +02:00
parent e7525d47be
commit 74f1a74a8c
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -60,7 +60,10 @@ class UDPSocket(BMProto):
self.socket = sock
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
try:
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
except AttributeError:
pass
self.destination = state.Peer(self.socket.getsockname()[0], self.socket.getsockname()[1])
ObjectTracker.__init__(self)
self.connecting = False