litex_server: set socket.SO_REUSEPORT to avoid waiting 60s in case of unclean termination
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 15 Apr 2019 06:23:27 +0000 (08:23 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 15 Apr 2019 06:23:27 +0000 (08:23 +0200)
litex/utils/litex_server.py

index b5dcb8f3a3818223c6ff08cb1812c93c96a52cd7..f8c6b116ed852f5ec27351bb5dd1bd0629099979 100755 (executable)
@@ -22,6 +22,7 @@ class RemoteServer(EtherboneIPC):
         if hasattr(self, "socket"):
             return
         self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        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)