You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by br...@apache.org on 2005/11/27 08:34:17 UTC

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

Author: brianp
Date: Sat Nov 26 23:34:15 2005
New Revision: 349190

URL: http://svn.apache.org/viewcvs?rev=349190&view=rev
Log:
When computing the timeouts for keepalives and write completion,
get the current time _after_ processing the event that led to the
timeout, rather than before.
[forward-port of commit 349189 from the async-read-dev branch]

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

Modified: httpd/httpd/trunk/server/mpm/experimental/event/event.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm/experimental/event/event.c?rev=349190&r1=349189&r2=349190&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/experimental/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/experimental/event/event.c Sat Nov 26 23:34:15 2005
@@ -565,14 +565,11 @@
     long conn_id = ID_FROM_CHILD_THREAD(my_child_num, my_thread_num);
     int csd;
     int rc;
-    apr_time_t time_now = 0;
     ap_sb_handle_t *sbh;
 
     ap_create_sb_handle(&sbh, p, my_child_num, my_thread_num);
     apr_os_sock_get(&csd, sock);
 
-    time_now = apr_time_now();
-
     if (cs == NULL) {           /* This is a new connection */
 
         cs = apr_pcalloc(p, sizeof(conn_state_t));
@@ -657,7 +654,7 @@
              * Set a write timeout for this connection, and let the
              * event thread poll for writeability.
              */
-            cs->expiration_time = ap_server_conf->timeout + time_now;
+            cs->expiration_time = ap_server_conf->timeout + apr_time_now();
             apr_thread_mutex_lock(timeout_mutex);
             APR_RING_INSERT_TAIL(&timeout_head, cs, conn_state_t, timeout_list);
             apr_thread_mutex_unlock(timeout_mutex);
@@ -698,7 +695,8 @@
          * timeout today.  With a normal client, the socket will be readable in
          * a few milliseconds anyway.
          */
-        cs->expiration_time = ap_server_conf->keep_alive_timeout + time_now;
+        cs->expiration_time = ap_server_conf->keep_alive_timeout +
+                              apr_time_now();
         apr_thread_mutex_lock(timeout_mutex);
         APR_RING_INSERT_TAIL(&keepalive_timeout_head, cs, conn_state_t, timeout_list);
         apr_thread_mutex_unlock(timeout_mutex);