From 5f49eab3131ff2f3d9078527fd5d556671f461d9 Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Thu, 29 Sep 2016 08:25:39 +0000 Subject: [PATCH] event: follow up to r1762718 and r1762742: put de condition where it belongs. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1762743 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/event/event.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index 7decebd41c..b6f9072a98 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -1798,19 +1798,17 @@ static void process_timeout_queue(struct timeout_queue *q, static void process_keepalive_queue(apr_time_t timeout_time) { - apr_uint32_t total = apr_atomic_read32(keepalive_q->total); - if (total) { - /* If all workers are busy, we kill older keep-alive connections so - * that they may connect to another process. - */ - if (!timeout_time) { - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, ap_server_conf, - "All workers are busy or dying, will close " - "%d keep-alive connections", (int)total); - } - process_timeout_queue(keepalive_q, timeout_time, - start_lingering_close_nonblocking); + /* If all workers are busy, we kill older keep-alive connections so + * that they may connect to another process. + */ + if (!timeout_time) { + ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, ap_server_conf, + "All workers are busy or dying, will close %u " + "keep-alive connections", + apr_atomic_read32(keepalive_q->total)); } + process_timeout_queue(keepalive_q, timeout_time, + start_lingering_close_nonblocking); } static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy) @@ -2225,7 +2223,8 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy) ps->suspended = apr_atomic_read32(&suspended_count); ps->lingering_close = apr_atomic_read32(&lingering_count); } - else if (workers_were_busy || dying) { + else if ((workers_were_busy || dying) + && apr_atomic_read32(keepalive_q->total)) { apr_thread_mutex_lock(timeout_mutex); process_keepalive_queue(0); /* kill'em all \m/ */ apr_thread_mutex_unlock(timeout_mutex); -- 2.50.1