From 4778e1e0dedd0b1c9234b1c959b8f4084009fb93 Mon Sep 17 00:00:00 2001 From: Brian Pane Date: Sun, 27 Nov 2005 07:34:15 +0000 Subject: [PATCH] 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] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@349190 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/experimental/event/event.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server/mpm/experimental/event/event.c b/server/mpm/experimental/event/event.c index 36a8621c3a..622a246464 100644 --- a/server/mpm/experimental/event/event.c +++ b/server/mpm/experimental/event/event.c @@ -565,14 +565,11 @@ static int process_socket(apr_pool_t * p, apr_socket_t * sock, 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 @@ read_request: * 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 @@ read_request: * 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); -- 2.40.0