From: Arran Cudbard-Bell Date: Wed, 12 Dec 2012 10:41:51 +0000 (+0000) Subject: Add more debugging for when we bail out of spawning a new connection X-Git-Tag: release_3_0_0_beta1~1373 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ab93a1d65590b90f8b29a952a0e7b71e24c77b8;p=thirdparty%2Ffreeradius-server.git Add more debugging for when we bail out of spawning a new connection --- diff --git a/src/main/connection.c b/src/main/connection.c index ad2cf2de5f2..f92dbd57352 100644 --- a/src/main/connection.c +++ b/src/main/connection.c @@ -167,8 +167,8 @@ static fr_connection_t *fr_connection_spawn(fr_connection_pool_t *fc, rad_assert(fc != NULL); /* - * Prevent all threads from blocking if the resource - * were managing connections for appears to be unavailable. + * Prevent all threads from blocking if the resource + * were managing connections for appears to be unavailable. */ if ((fc->num == 0) && fc->spawning) { return NULL; @@ -177,7 +177,18 @@ static fr_connection_t *fr_connection_spawn(fr_connection_pool_t *fc, pthread_mutex_lock(&fc->mutex); rad_assert(fc->num <= fc->max); - if ((fc->last_failed == now) || fc->spawning) { + if (fc->last_failed == now) { + radlog(L_ERR, "%s: Last connection failed, throttling " + "connection spawn", fc->log_prefix); + + pthread_mutex_unlock(&fc->mutex); + return NULL; + } + + if (fc->spawning) { + radlog(L_ERR, "%s: Cannot open new connection, connection " + "spawning already in progress", fc->log_prefix); + pthread_mutex_unlock(&fc->mutex); return NULL; } @@ -756,6 +767,7 @@ void *fr_connection_reconnect(fr_connection_pool_t *fc, void *conn) radlog(L_ERR, "%s: Failed to reconnect (%i), and no other connections available", fc->log_prefix, conn_number); + return NULL; }