From d7413d2ba8497d5013f46f1ce304c03913692d9a Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Fri, 4 Dec 2009 10:28:46 +0000 Subject: [PATCH] Apply client_login_timeout to clients waiting for welcome pkt Otherwise the clients stay waiting infinitely, unless there is query_timeout set. This only applies for servers that have never been up. If server has been connected once, the query_timeout is only thing that kills clients, as clients are let freely log in after first connect to server. --- src/janitor.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/janitor.c b/src/janitor.c index 0de654e..5da7e68 100644 --- a/src/janitor.c +++ b/src/janitor.c @@ -338,6 +338,16 @@ static void pool_client_maint(PgPool *pool) disconnect_client(client, true, "query_timeout"); } } + + /* apply client_login_timeout to clients waiting for welcome pkt */ + if (cf_client_login_timeout > 0 && !pool->welcome_msg_ready) { + statlist_for_each_safe(item, &pool->waiting_client_list, tmp) { + client = container_of(item, PgSocket, head); + age = now - client->connect_time; + if (age > cf_client_login_timeout) + disconnect_client(client, true, "client_login_timeout (server down)"); + } + } } static void check_unused_servers(PgPool *pool, StatList *slist, bool idle_test) -- 2.40.0