Fix internal server on OpenBSD

On OpenBSD closed sockets are handled as exceptional conditions.
Fixes #1062
This commit is contained in:
Unrud 2020-06-06 21:05:01 +02:00
parent e07f047fad
commit f780853d8f

View File

@ -260,7 +260,7 @@ def serve(configuration, shutdown_socket):
max_connections = configuration.get("server", "max_connections")
logger.info("Radicale server ready")
while True:
rlist = xlist = []
rlist = []
# Wait for finished clients
for server in servers.values():
rlist.extend(server.client_sockets)
@ -269,9 +269,7 @@ def serve(configuration, shutdown_socket):
rlist.extend(servers)
# Use socket to get notified of program shutdown
rlist.append(shutdown_socket)
rlist, _, xlist = select.select(rlist, [], xlist, select_timeout)
if xlist:
raise RuntimeError("unhandled socket error")
rlist, _, _ = select.select(rlist, [], [], select_timeout)
rlist = set(rlist)
if shutdown_socket in rlist:
logger.info("Stopping Radicale")