From 4e8302d10dbe8ee955a715e31c028e6dc8cc4b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chaloupka?= Date: Wed, 31 Jul 2019 14:41:26 +0200 Subject: [PATCH] unlock ConnectionPool on failure --- source/vibe/core/connectionpool.d | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/vibe/core/connectionpool.d b/source/vibe/core/connectionpool.d index 373a024..ce13b3b 100644 --- a/source/vibe/core/connectionpool.d +++ b/source/vibe/core/connectionpool.d @@ -74,6 +74,8 @@ final class ConnectionPool(Connection) debug assert(m_thread is () @trusted { return Thread.getThis(); } (), "ConnectionPool was called from a foreign thread!"); () @trusted { m_sem.lock(); } (); + scope (failure) () @trusted { m_sem.unlock(); } (); + size_t cidx = size_t.max; foreach( i, c; m_connections ){ auto plc = c in m_lockCount;