From: Jeff Trawick Date: Tue, 5 Feb 2002 12:52:01 +0000 (+0000) Subject: restore the SO_REUSEADDR for listening sockets; it is absolutely X-Git-Tag: 2.0.32~77 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a0bb255db4af8d07e1f359e0aa2da012d755091c;p=apache 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 --- 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,