From 048b796ff584567658c326f20847ca8f84b2a24e Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Mon, 6 Apr 2020 18:29:17 +0000 Subject: [PATCH] Enable SO_REUSEADDR again --- src/server.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/server.c b/src/server.c index 4352666..45e3d91 100644 --- a/src/server.c +++ b/src/server.c @@ -796,9 +796,14 @@ int bind_address(const char* name, int port) if (fd < 0) continue; + int one = 1; + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(int)) < 0) + goto failure; + if (bind(fd, p->ai_addr, p->ai_addrlen) == 0) break; +failure: close(fd); fd = -1; }