From: Marko Kreen Date: Fri, 22 May 2009 14:39:09 +0000 (+0000) Subject: Fix potential use of old connections after config change X-Git-Tag: pgbouncer_1_3_1_rc1~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=04cdea5dad4e58940d026f8f25613e079933bacd;p=pgbouncer Fix potential use of old connections after config change Despite detecting and tagging them for close on config change, the closing happened only in long-term maintenance. So there was time where they could still be reused by clients. Fix this by strict check in find_server() --- diff --git a/src/objects.c b/src/objects.c index d1b75c5..7212030 100644 --- a/src/objects.c +++ b/src/objects.c @@ -500,9 +500,14 @@ bool find_server(PgSocket *client) } else { while (1) { server = first_socket(&pool->idle_server_list); - if (!server || server->ready) + if (!server) + break; + else if (server->close_needed) + disconnect_server(server, true, "obsolete connection"); + else if (!server->ready) + disconnect_server(server, true, "idle server got dirty"); + else break; - disconnect_server(server, true, "idle server got dirty"); } } Assert(!server || server->state == SV_IDLE);