From a5e664d83da7b1e075258e09f6cc7e2e79eee20a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Papp?= Date: Tue, 18 Jun 2024 11:27:18 +0200 Subject: [PATCH] Code cleaning --- client/internal/peer/conn.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/internal/peer/conn.go b/client/internal/peer/conn.go index f729bc61a..1b2538187 100644 --- a/client/internal/peer/conn.go +++ b/client/internal/peer/conn.go @@ -162,6 +162,7 @@ func (conn *Conn) Open() { // Close closes this peer Conn issuing a close event to the Conn closeCh func (conn *Conn) Close() { conn.mu.Lock() + defer conn.mu.Unlock() conn.ctxCancel() if conn.wgProxy != nil { @@ -208,8 +209,6 @@ func (conn *Conn) Close() { if err := conn.statusRecorder.UpdateWireGuardPeerState(conn.config.Key, iface.WGStats{}); err != nil { conn.log.Debugf("failed to reset wireguard stats for peer: %s", err) } - - conn.mu.Unlock() } // OnRemoteAnswer handles an offer from the remote peer and returns true if the message was accepted, false otherwise