You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2016/09/29 08:25:39 UTC

svn commit: r1762743 - /httpd/httpd/trunk/server/mpm/event/event.c

Author: ylavic
Date: Thu Sep 29 08:25:39 2016
New Revision: 1762743

URL: http://svn.apache.org/viewvc?rev=1762743&view=rev
Log:
event: follow up to r1762718 and r1762742: put de condition where it belongs.


Modified:
    httpd/httpd/trunk/server/mpm/event/event.c

Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1762743&r1=1762742&r2=1762743&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Thu Sep 29 08:25:39 2016
@@ -1798,19 +1798,17 @@ static void process_timeout_queue(struct
 
 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_t
             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);