Skip to content

Commit d1f7864

Browse files
authored
Try rehandshaking a main hostinfo after releasing hostmap locks (#863)
1 parent 31ed926 commit d1f7864

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

connection_manager.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ import (
1717
type trafficDecision int
1818

1919
const (
20-
doNothing trafficDecision = 0
21-
deleteTunnel trafficDecision = 1 // delete the hostinfo on our side, do not notify the remote
22-
closeTunnel trafficDecision = 2 // delete the hostinfo and notify the remote
23-
swapPrimary trafficDecision = 3
24-
migrateRelays trafficDecision = 4
20+
doNothing trafficDecision = 0
21+
deleteTunnel trafficDecision = 1 // delete the hostinfo on our side, do not notify the remote
22+
closeTunnel trafficDecision = 2 // delete the hostinfo and notify the remote
23+
swapPrimary trafficDecision = 3
24+
migrateRelays trafficDecision = 4
25+
tryRehandshake trafficDecision = 5
2526
)
2627

2728
type connectionManager struct {
@@ -193,6 +194,9 @@ func (n *connectionManager) doTrafficCheck(localIndex uint32, p, nb, out []byte,
193194

194195
case migrateRelays:
195196
n.migrateRelayUsed(hostinfo, primary)
197+
198+
case tryRehandshake:
199+
n.tryRehandshake(hostinfo)
196200
}
197201

198202
n.resetRelayTrafficCheck(hostinfo)
@@ -321,7 +325,8 @@ func (n *connectionManager) makeTrafficDecision(localIndex uint32, p, nb, out []
321325
delete(n.pendingDeletion, hostinfo.localIndexId)
322326

323327
if mainHostInfo {
324-
n.tryRehandshake(hostinfo)
328+
decision = tryRehandshake
329+
325330
} else {
326331
if n.shouldSwapPrimary(hostinfo, primary) {
327332
decision = swapPrimary

0 commit comments

Comments
 (0)