From d1f786419cc6f53344a8d4e39bace48bd2565554 Mon Sep 17 00:00:00 2001 From: Nate Brown Date: Mon, 8 May 2023 14:43:03 -0500 Subject: [PATCH] Try rehandshaking a main hostinfo after releasing hostmap locks (#863) --- connection_manager.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/connection_manager.go b/connection_manager.go index efd0a92..a754a84 100644 --- a/connection_manager.go +++ b/connection_manager.go @@ -17,11 +17,12 @@ import ( type trafficDecision int const ( - doNothing trafficDecision = 0 - deleteTunnel trafficDecision = 1 // delete the hostinfo on our side, do not notify the remote - closeTunnel trafficDecision = 2 // delete the hostinfo and notify the remote - swapPrimary trafficDecision = 3 - migrateRelays trafficDecision = 4 + doNothing trafficDecision = 0 + deleteTunnel trafficDecision = 1 // delete the hostinfo on our side, do not notify the remote + closeTunnel trafficDecision = 2 // delete the hostinfo and notify the remote + swapPrimary trafficDecision = 3 + migrateRelays trafficDecision = 4 + tryRehandshake trafficDecision = 5 ) type connectionManager struct { @@ -193,6 +194,9 @@ func (n *connectionManager) doTrafficCheck(localIndex uint32, p, nb, out []byte, case migrateRelays: n.migrateRelayUsed(hostinfo, primary) + + case tryRehandshake: + n.tryRehandshake(hostinfo) } n.resetRelayTrafficCheck(hostinfo) @@ -321,7 +325,8 @@ func (n *connectionManager) makeTrafficDecision(localIndex uint32, p, nb, out [] delete(n.pendingDeletion, hostinfo.localIndexId) if mainHostInfo { - n.tryRehandshake(hostinfo) + decision = tryRehandshake + } else { if n.shouldSwapPrimary(hostinfo, primary) { decision = swapPrimary