From 13e0852af48accf941d10e61639a1838ed0f0ca0 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Sat, 20 Jun 2020 22:20:29 +0200 Subject: [PATCH] tools/litex_server: set socket option flags separately (required for Mac OS X). --- litex/tools/litex_server.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/litex/tools/litex_server.py b/litex/tools/litex_server.py index e17fe115..b35bda5d 100755 --- a/litex/tools/litex_server.py +++ b/litex/tools/litex_server.py @@ -26,13 +26,11 @@ class RemoteServer(EtherboneIPC): def open(self): if hasattr(self, "socket"): return - socket_flags = 0 + self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if hasattr(socket, "SO_REUSEADDR"): - socket_flags = socket_flags | socket.SO_REUSEADDR + self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) if hasattr(socket, "SO_REUSEPORT"): - socket_flags = socket_flags | socket.SO_REUSEPORT - self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.socket.setsockopt(socket.SOL_SOCKET, socket_flags, 1) + self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) self.socket.bind((self.bind_ip, self.bind_port)) print("tcp port: {:d}".format(self.bind_port)) self.socket.listen(1) -- 2.30.2