Skip to content

Commit

Permalink
Merge pull request #1855 from openziti/fix-unroute-panic
Browse files Browse the repository at this point in the history
Fix panic if router is disconnected in unroute. Fixes #1854
  • Loading branch information
plorenz authored Mar 21, 2024
2 parents 3cdb009 + 3c3bfb6 commit 58b8048
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions controller/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,14 +594,14 @@ func (network *Network) CreateCircuit(params CreateCircuitParams) (*Circuit, err
// revert successful routes
logger.Warnf("circuit creation failed after [%d] attempts, sending cleanup unroutes", network.options.CreateCircuitRetries)
for cleanupRId := range allCleanups {
if r, err := network.GetRouter(cleanupRId); err == nil {
if r := network.GetConnectedRouter(cleanupRId); r != nil {
if err := sendUnroute(r, circuitId, true); err == nil {
logger.WithField("routerId", cleanupRId).Debug("sent cleanup unroute for circuit")
} else {
logger.WithField("routerId", cleanupRId).Error("error sending cleanup unroute for circuit")
}
} else {
logger.WithField("routerId", cleanupRId).Error("missing router for circuit cleanup")
logger.WithField("routerId", cleanupRId).Error("router for circuit cleanup not connected")
}
}

Expand All @@ -618,14 +618,14 @@ func (network *Network) CreateCircuit(params CreateCircuitParams) (*Circuit, err
for cleanupRId := range allCleanups {
if _, found := usedRouters[cleanupRId]; !found {
cleanupCount++
if r, err := network.GetRouter(cleanupRId); err == nil {
if r := network.GetConnectedRouter(cleanupRId); r != nil {
if err := sendUnroute(r, circuitId, true); err == nil {
logger.WithField("routerId", cleanupRId).Debug("sent abandoned cleanup unroute for circuit to router")
} else {
logger.WithField("routerId", cleanupRId).WithError(err).Error("error sending abandoned cleanup unroute for circuit to router")
}
} else {
logger.WithField("routerId", cleanupRId).Error("missing router for circuit, abandoned cleanup")
logger.WithField("routerId", cleanupRId).Error("router not connected for circuit, abandoned cleanup")
}
}
}
Expand Down

0 comments on commit 58b8048

Please sign in to comment.