summaryrefslogtreecommitdiffstats
path: root/server/mpm/event/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/mpm/event/event.c')
-rw-r--r--server/mpm/event/event.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c
index 8e5bc8e0fe..34762f9df4 100644
--- a/server/mpm/event/event.c
+++ b/server/mpm/event/event.c
@@ -561,6 +561,11 @@ static APR_INLINE int connections_above_limit(int *busy)
return 1;
}
+static APR_INLINE int should_enable_listensocks(void)
+{
+ return !dying && listeners_disabled() && !connections_above_limit(NULL);
+}
+
static void close_socket_nonblocking_(apr_socket_t *csd,
const char *from, int line)
{
@@ -816,7 +821,7 @@ static apr_status_t decrement_connection_count(void *cs_)
is_last_connection = !apr_atomic_dec32(&connection_count);
if (listener_is_wakeable
&& ((is_last_connection && listener_may_exit)
- || (listeners_disabled() && !connections_above_limit(NULL)))) {
+ || should_enable_listensocks())) {
apr_pollset_wakeup(event_pollset);
}
if (dying) {
@@ -2308,9 +2313,7 @@ do_maintenance:
}
}
- if (listeners_disabled()
- && !workers_were_busy
- && !connections_above_limit(NULL)) {
+ if (!workers_were_busy && should_enable_listensocks()) {
enable_listensocks();
}
} /* listener main loop */
@@ -2372,7 +2375,7 @@ static void *APR_THREAD_FUNC worker_thread(apr_thread_t * thd, void *dummy)
ap_update_child_status_from_indexes(process_slot, thread_slot,
SERVER_STARTING, NULL);
- while (!workers_may_exit) {
+ for (;;) {
apr_socket_t *csd = NULL;
event_conn_state_t *cs;
timer_event_t *te = NULL;
@@ -2388,6 +2391,12 @@ static void *APR_THREAD_FUNC worker_thread(apr_thread_t * thd, void *dummy)
signal_threads(ST_GRACEFUL);
break;
}
+ /* A new idler may have changed connections_above_limit(),
+ * let the listener know and decide.
+ */
+ if (listener_is_wakeable && should_enable_listensocks()) {
+ apr_pollset_wakeup(event_pollset);
+ }
is_idle = 1;
}
@@ -3359,7 +3368,7 @@ static void server_main_loop(int remaining_children_to_start)
event_note_child_killed(child_slot, 0, 0);
ps = &ap_scoreboard_image->parent[child_slot];
- if (!ps->quiescing)
+ if (ps->quiescing != 2)
retained->active_daemons--;
ps->quiescing = 0;
/* NOTE: We don't dec in the (child_slot < 0) case! */