From: Alan T. DeKok Date: Mon, 17 Oct 2011 19:22:09 +0000 (+0200) Subject: Add undocumented "lazy init" configuration. X-Git-Tag: release_3_0_0_beta0~578 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8279dc5077e7cb129613a43be667b5f22a7af10;p=thirdparty%2Ffreeradius-server.git Add undocumented "lazy init" configuration. This allows the connection pool to return on init, even if it's unable to make any new connections. The result is that the server can start even when the back-end DB is down. That's nearly always a bad idea, but it's easy enough to do with the new connection pool code. --- diff --git a/src/main/connection.c b/src/main/connection.c index 39dcfdf8adf..cc77ff63434 100644 --- a/src/main/connection.c +++ b/src/main/connection.c @@ -64,6 +64,7 @@ struct fr_connection_pool_t { int max_uses; int lifetime; int idle_timeout; + int lazy_init; fr_connection_t *head, *tail; @@ -102,6 +103,8 @@ static const CONF_PARSER connection_config[] = { 0, "0" }, { "idle_timeout", PW_TYPE_INTEGER, offsetof(fr_connection_pool_t, idle_timeout), 0, "60" }, + { "lazy", PW_TYPE_BOOLEAN, offsetof(fr_connection_pool_t, lazy_init), + 0, NULL }, { NULL, -1, 0, NULL, NULL } }; @@ -289,9 +292,10 @@ fr_connection_pool_t *fr_connection_pool_init(CONF_SECTION *parent, } /* - * Create all of the connections. + * Create all of the connections, unless the admin says + * not to. */ - for (i = 0; i < fc->start; i++) { + if (!fc->lazy_init) for (i = 0; i < fc->start; i++) { time_t now = time(NULL); DEBUG("%s: Spawning additional connection (%i)", fc->log_prefix, fc->count);