Skip to content

Commit

Permalink
Simpler method of deleting connections from a pool
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Feb 5, 2015
1 parent 6333edc commit 962a4dd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/connection.c
Expand Up @@ -572,7 +572,7 @@ int fr_connection_del(fr_connection_pool_t *pool, void *conn)
*/
void fr_connection_pool_delete(fr_connection_pool_t *pool)
{
fr_connection_t *this, *next;
fr_connection_t *this;

if (!pool) return;

Expand All @@ -582,9 +582,11 @@ void fr_connection_pool_delete(fr_connection_pool_t *pool)

fr_heap_delete(pool->heap);

for (this = pool->head; this != NULL; this = next) {
next = this->next;

/*
* Don't loop over the list. Just keep removing the head
* until they're all gone.
*/
while ((this = pool->head) != NULL) {
INFO("%s: Closing connection (%" PRIu64 ")", pool->log_prefix, this->number);

fr_connection_close(pool, this);
Expand Down

0 comments on commit 962a4dd

Please sign in to comment.