From 7451ce5cfb708ef30fd06c7bacfde61a3467d94e Mon Sep 17 00:00:00 2001 From: Ron Frederick Date: Sat, 30 Oct 2021 06:14:28 +0100 Subject: [PATCH] server: SO_REUSEPORT: enable with LWS_MAX_SMP > 1 Either explicit option selection, or multiple SMP service threads, should enable SO_REUSEPORT https://github.com/warmcat/libwebsockets/issues/2470 --- lib/roles/http/server/server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/roles/http/server/server.c b/lib/roles/http/server/server.c index cb56907f2..150eeec56 100644 --- a/lib/roles/http/server/server.c +++ b/lib/roles/http/server/server.c @@ -261,7 +261,7 @@ done_list: n = lws_check_opt(a->vhost->options, LWS_SERVER_OPTION_ALLOW_LISTEN_SHARE); #endif - if (n && cx->count_threads > 1) + if (n || cx->count_threads > 1) /* ... also implied by threads > 1 */ if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT, (const void *)&opt, sizeof(opt)) < 0) { compatible_close(sockfd);