diff options
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 55604eb8..9300a43f 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -5041,8 +5041,23 @@ MHD_start_daemon_va (unsigned int flags, | |||
5041 | } | 5041 | } |
5042 | else if (daemon->listening_address_reuse > 0) | 5042 | else if (daemon->listening_address_reuse > 0) |
5043 | { | 5043 | { |
5044 | /* User requested to allow reusing listening address:port. | 5044 | /* User requested to allow reusing listening address:port. */ |
5045 | * Use SO_REUSEADDR on Windows and SO_REUSEPORT on most platforms. | 5045 | #ifndef _WIN32 |
5046 | /* Use SO_REUSEADDR on non-W32 platforms, and do not fail if | ||
5047 | * it doesn't work. */ | ||
5048 | if (0 > setsockopt (socket_fd, | ||
5049 | SOL_SOCKET, | ||
5050 | SO_REUSEADDR, | ||
5051 | (void*)&on, sizeof (on))) | ||
5052 | { | ||
5053 | #ifdef HAVE_MESSAGES | ||
5054 | MHD_DLOG (daemon, | ||
5055 | _("setsockopt failed: %s\n"), | ||
5056 | MHD_socket_last_strerr_ ()); | ||
5057 | #endif | ||
5058 | } | ||
5059 | #endif /* ! _WIN32 */ | ||
5060 | /* Use SO_REUSEADDR on Windows and SO_REUSEPORT on most platforms. | ||
5046 | * Fail if SO_REUSEPORT is not defined or setsockopt fails. | 5061 | * Fail if SO_REUSEPORT is not defined or setsockopt fails. |
5047 | */ | 5062 | */ |
5048 | /* SO_REUSEADDR on W32 has the same semantics | 5063 | /* SO_REUSEADDR on W32 has the same semantics |