From be19bcefe0ccdb2e00492d1a2a2fc7319bad9a1d Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Tue, 5 Feb 2002 12:52:01 +0000 Subject: [PATCH] restore the SO_REUSEADDR for listening sockets; it is absolutely required on most (all?) platforms, regardless of what code changes might be required to work around the ability on Windows to inadvertently have more than one server listening on the same ports git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93252 13f79535-47bb-0310-9956-ffa450edef68 --- server/listen.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/listen.c b/server/listen.c index 4f06f44e39..b94f3f10ac 100644 --- a/server/listen.c +++ b/server/listen.c @@ -89,6 +89,15 @@ static apr_status_t make_sock(apr_pool_t *p, ap_listen_rec *server) int one = 1; apr_status_t stat; + stat = apr_setsocketopt(s, APR_SO_REUSEADDR, one); + if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) { + ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p, + "make_sock: for address %pI, setsockopt: (SO_REUSEADDR)", + server->bind_addr); + apr_socket_close(s); + return stat; + } + stat = apr_setsocketopt(s, APR_SO_KEEPALIVE, one); if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) { ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p, -- 2.50.1