From 5f8215e5a053b65bdccf2b3f13ec068bbb45a24a Mon Sep 17 00:00:00 2001 From: Greg Stein Date: Thu, 13 Jul 2000 09:17:46 +0000 Subject: [PATCH] reverse the setup_listeners() change from a few days ago. it broke prefork by not getting listenmaxfd set, nor listenfds. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85830 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/prefork/prefork.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 0b5a540c4d..fa5166e425 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -1257,6 +1257,29 @@ static void perform_idle_server_maintenance(void) } } +static int setup_listeners(server_rec *s) +{ + ap_listen_rec *lr; + int sockdes; + + if (ap_listen_open(s->process, s->port)) { + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s, + "no listening sockets available, shutting down"); + return -1; + } + + listenmaxfd = -1; + FD_ZERO(&listenfds); + for (lr = ap_listeners; lr; lr = lr->next) { + ap_get_os_sock(&sockdes, lr->sd); + FD_SET(sockdes, &listenfds); + if (sockdes > listenmaxfd) { + listenmaxfd = sockdes; + } + } + return 0; +} + /* Useful to erase the status of children that might be from previous * generations */ static void ap_prefork_force_reset_connection_status(long conn_id) @@ -1288,7 +1311,7 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) ap_log_pid(pconf, ap_pid_fname); - if (ap_setup_listeners(s)) { + if (setup_listeners(s)) { /* XXX: hey, what's the right way for the mpm to indicate a fatal error? */ return 1; } -- 2.50.1