Skip to content

Commit

Permalink
QueryServer needs to be done outside of the lock (#996)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrownus authored Oct 17, 2023
1 parent e78fe0b commit 50d6a1e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion handshake_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -361,6 +361,7 @@ func (hm *HandshakeManager) StartHandshake(vpnIp iputil.VpnIp, cacheCb func(*Hos
}
}

hm.Unlock()
hm.lightHouse.QueryServer(vpnIp, hm.f)
return hostinfo
}
Expand Down

0 comments on commit 50d6a1e

Please sign in to comment.