diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/listen.c | 20 | ||||
-rw-r--r-- | server/mpm/netware/mpm_netware.c | 3 |
2 files changed, 20 insertions, 3 deletions
diff --git a/server/listen.c b/server/listen.c index 56a99751bc..e6873baec4 100644 --- a/server/listen.c +++ b/server/listen.c @@ -383,6 +383,26 @@ static int ap_listen_open(apr_pool_t *pool, apr_port_t port) } old_listeners = NULL; +#if AP_NONBLOCK_WHEN_MULTI_LISTEN + /* if multiple listening sockets, make them non-blocking so that + * if select()/poll() reports readability for a reset connection that + * is already forgotten about by the time we call accept, we won't + * be hung until another connection arrives on that port + */ + if (ap_listeners->next) { + for (lr = ap_listeners; lr; lr = lr->next) { + apr_status_t status; + + status = apr_socket_opt_set(lr->sd, APR_SO_NONBLOCK, 1); + if (status != APR_SUCCESS) { + ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_ERR, status, pool, + "ap_listen_open: unable to make socket non-blocking"); + return -1; + } + } + } +#endif /* AP_NONBLOCK_WHEN_MULTI_LISTEN */ + /* we come through here on both passes of the open logs phase * only register the cleanup once... otherwise we try to close * listening sockets twice when cleaning up prior to exec diff --git a/server/mpm/netware/mpm_netware.c b/server/mpm/netware/mpm_netware.c index 34e8cbf56e..27f0e51720 100644 --- a/server/mpm/netware/mpm_netware.c +++ b/server/mpm/netware/mpm_netware.c @@ -828,9 +828,6 @@ static int setup_listeners(server_rec *s) if (sockdes > listenmaxfd) { listenmaxfd = sockdes; } - /* Use non-blocking listen sockets so that we - never get hung up. */ - apr_socket_opt_set(lr->sd, APR_SO_NONBLOCK, 1); } return 0; } |