From fffd6dbe7cfd22fda9dc4270e5390b93811c8c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20B=C3=B6rjesson?= Date: Thu, 12 Dec 2024 08:25:38 +0100 Subject: [PATCH] Always close socket in Follower#close --- src/lavinmq/clustering/follower.cr | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lavinmq/clustering/follower.cr b/src/lavinmq/clustering/follower.cr index 990374ae03..7314c3ce4b 100644 --- a/src/lavinmq/clustering/follower.cr +++ b/src/lavinmq/clustering/follower.cr @@ -59,7 +59,7 @@ module LavinMQ end ensure begin - @lz4.close + lz4.close unless lz4.closed? @socket.close rescue IO::Error # ignore connection errors while closing @@ -186,6 +186,9 @@ module LavinMQ Log.warn { "Timeout waiting for follower to be in sync" } end end + ensure + @lz4.close unless @lz4.closed? + @socket.close end def to_json(json : JSON::Builder)