]> granicus.if.org Git - apache/commitdiff
restore the SO_REUSEADDR for listening sockets; it is absolutely
authorJeff Trawick <trawick@apache.org>
Tue, 5 Feb 2002 12:52:01 +0000 (12:52 +0000)
committerJeff Trawick <trawick@apache.org>
Tue, 5 Feb 2002 12:52:01 +0000 (12:52 +0000)
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

index 4f06f44e39dfc1a33e8cca6dc853ef4674b47c4a..b94f3f10ac0ac993a5dc4e422141ecf04688d037 100644 (file)
@@ -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,