From b2cd834db7d302fd8968b32d40e13d94fcd34413 Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Tue, 29 Sep 2020 23:51:10 +0000 Subject: [PATCH] Cleanup: Move lock out of loop as unlock is also outside the loop --- src/source.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/source.c b/src/source.c index 130187a1..9668abb0 100644 --- a/src/source.c +++ b/src/source.c @@ -389,13 +389,13 @@ void source_move_clients(source_t *source, source_t *dest) return; } + /* we need to move the client and pending trees - we must take the + * locks in this order to avoid deadlocks */ + avl_tree_wlock(source->pending_tree); + avl_tree_wlock(source->client_tree); + do { - /* we need to move the client and pending trees - we must take the - * locks in this order to avoid deadlocks */ - avl_tree_wlock(source->pending_tree); - avl_tree_wlock(source->client_tree); - if (source->on_demand == 0 && source->format == NULL) { ICECAST_LOG_INFO("source mount %s is not available", source->mount);