From bd12ed7ddc0de323a00909a35479913e5a7d58f5 Mon Sep 17 00:00:00 2001 From: Alexander Indenbaum Date: Sat, 7 Oct 2023 21:26:47 +0300 Subject: [PATCH] Set the SO_REUSEADDR option Signed-off-by: Alexander Indenbaum --- control/discovery.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/control/discovery.py b/control/discovery.py index d91ee23de..18a9e83ed 100644 --- a/control/discovery.py +++ b/control/discovery.py @@ -1022,6 +1022,8 @@ def start_service(self): """Enable listening on the server side.""" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + # Set the SO_REUSEADDR option + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind((self.discovery_addr, int(self.discovery_port))) sock.listen(MAX_CONNECTION) sock.setblocking(False)