From 74f1a74a8c6ae0a0df18c2ea4b97c751bfb260e9 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Mon, 29 May 2017 11:30:56 +0200 Subject: [PATCH] Make SO_REUSEPORT optional - apparently not available on Windows --- src/network/udp.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/udp.py b/src/network/udp.py index 5412083f..48a805d8 100644 --- a/src/network/udp.py +++ b/src/network/udp.py @@ -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) - self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 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