From 2a73d9f7eeff3841eeba24f1d7d0829c3e7ed929 Mon Sep 17 00:00:00 2001 From: Andy Kittner Date: Tue, 12 Nov 2013 21:39:03 +0100 Subject: [PATCH] Set reuse address option (fixes #1043) When the server is killed there may still be client-sockets connected in the TIME_WAIT state, causing the bind() call to fail. With the REUSEADDR option we can reuse the address immediately unless another process is actually *listening* on the same address. that we want to reuse the address --- openslides/utils/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openslides/utils/main.py b/openslides/utils/main.py index e111fe062..210347a44 100644 --- a/openslides/utils/main.py +++ b/openslides/utils/main.py @@ -296,6 +296,7 @@ def get_port(address, port): """ s = socket.socket() try: + s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((address, port)) s.listen(-1) except socket.error: