From 0b860b2a0c5027e12aa78cd8df623fcf84bb272b Mon Sep 17 00:00:00 2001 From: Thomas Porzelt Date: Mon, 14 Jun 2010 20:34:58 +0200 Subject: [PATCH] [core] Ensure a connection is put into io timeout queue after keepalive] --- src/main/connection.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/connection.c b/src/main/connection.c index 28fa4f7..ccb5c59 100644 --- a/src/main/connection.c +++ b/src/main/connection.c @@ -155,6 +155,10 @@ static gboolean connection_handle_read(liConnection *con) { con->keep_alive_data.timeout = 0; ev_timer_stop(con->wrk->loop, &con->keep_alive_data.watcher); + /* put back in io timeout queue */ + if (!con->io_timeout_elem.queued) + li_waitqueue_push(&con->wrk->io_timeout_queue, &con->io_timeout_elem); + con->keep_alive_requests++; /* disable keep alive if limit is reached */ if (con->keep_alive_requests == CORE_OPTION(LI_CORE_OPTION_MAX_KEEP_ALIVE_REQUESTS).number) @@ -603,6 +607,9 @@ static void li_connection_reset_keep_alive(liConnection *con) { ev_timer_start(con->wrk->loop, &con->keep_alive_data.watcher); } } + + /* remove from timeout queue */ + li_waitqueue_remove(&con->wrk->io_timeout_queue, &con->io_timeout_elem); } con->state = LI_CON_STATE_KEEP_ALIVE; @@ -632,9 +639,6 @@ static void li_connection_reset_keep_alive(liConnection *con) { con->stats.bytes_out_5s_diff = G_GUINT64_CONSTANT(0); con->stats.last_avg = 0; - /* remove from timeout queue */ - li_waitqueue_remove(&con->wrk->io_timeout_queue, &con->io_timeout_elem); - li_throttle_reset(con); if (con->raw_in->length != 0) {