summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-10-27 16:53:25 -0400
committerJune McEnroe <june@causal.agency>2019-10-27 16:53:25 -0400
commitf2555e841105a7ead9ed4794fe2b3d185ad7f880 (patch)
tree0abd1287ff5fdd3f15f77d9d1299be23e5a2e1db
parentOutput ring info on SIGINFO (diff)
downloadpounce-f2555e841105a7ead9ed4794fe2b3d185ad7f880.tar.gz
pounce-f2555e841105a7ead9ed4794fe2b3d185ad7f880.zip
Set SO_REUSEADDR on binds
-rw-r--r--listen.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/listen.c b/listen.c
index 952d798..1797acf 100644
--- a/listen.c
+++ b/listen.c
@@ -63,6 +63,10 @@ size_t listenBind(int fds[], size_t cap, const char *host, const char *port) {
 		fds[len] = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
 		if (fds[len] < 0) err(EX_OSERR, "socket");
 
+		int yes = 1;
+		error = setsockopt(fds[len], SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes));
+		if (error) err(EX_OSERR, "setsockopt");
+
 		error = bind(fds[len], ai->ai_addr, ai->ai_addrlen);
 		if (error) {
 			warn("%s:%s", host, port);
nroe 2020-08-03doc: Indicate that only OpenSSL 1.1.1b and newer workJune McEnroe1-04-18build: Remove added x509_verify.3 links 3.3.2June McEnroe 2021-04-18tls: Use EC_KEY_set_ex_dataJune McEnroe 2021-04-18Import LibreSSL 3.3.2June McEnroe 2021-03-05Bump version to 3.3.1p1 3.3.1p1June McEnroe 2021-03-05build: Add OpenSSL includes to libcompatJune McEnroe 2020-12-15Import LibreSSL 3.3.1June McEnroe 2020-11-24Import LibreSSL 3.3.0June McEnroe 2020-10-22Import LibreSSL 3.2.2June McEnroe 2020-09-29Import LibreSSL 3.2.1June McEnroe 2020-09-29import: Add m4/ax_add_fortify_source.m4June McEnroe 2020-08-05build: Add README.7 to EXTRA_DIST 3.2.0June McEnroe 2020-08-03doc: Indicate that only OpenSSL 1.1.1b and newer workJune McEnroe