Skip to content

Commit

Permalink
Try rehandshaking a main hostinfo after releasing hostmap locks (#863)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrownus committed May 8, 2023
1 parent 31ed926 commit d1f7864
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions connection_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d1f7864

Please sign in to comment.