From 50d6a1e8cae1fa60668f62405e2020e990706cf7 Mon Sep 17 00:00:00 2001 From: Nate Brown Date: Tue, 17 Oct 2023 15:43:51 -0500 Subject: [PATCH] QueryServer needs to be done outside of the lock (#996) --- handshake_manager.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/handshake_manager.go b/handshake_manager.go index e2c2cf548..11c0c6f83 100644 --- a/handshake_manager.go +++ b/handshake_manager.go @@ -318,13 +318,13 @@ func (hm *HandshakeManager) GetOrHandshake(vpnIp iputil.VpnIp, cacheCb func(*Hos // StartHandshake will ensure a handshake is currently being attempted for the provided vpn ip func (hm *HandshakeManager) StartHandshake(vpnIp iputil.VpnIp, cacheCb func(*HostInfo)) *HostInfo { hm.Lock() - defer hm.Unlock() if hostinfo, ok := hm.vpnIps[vpnIp]; ok { // We are already trying to handshake with this vpn ip if cacheCb != nil { cacheCb(hostinfo) } + hm.Unlock() return hostinfo } @@ -361,6 +361,7 @@ func (hm *HandshakeManager) StartHandshake(vpnIp iputil.VpnIp, cacheCb func(*Hos } } + hm.Unlock() hm.lightHouse.QueryServer(vpnIp, hm.f) return hostinfo }