Skip to content

Commit

Permalink
Handle duplicate tunnel terminator creation gracefully. Fixes #1355
Browse files Browse the repository at this point in the history
  • Loading branch information
plorenz committed Mar 22, 2023
1 parent f9d8dd2 commit 431df85
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions controller/handler_edge_ctrl/create_tunnel_terminator.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,17 @@ func (self *createTunnelTerminatorHandler) CreateTerminator(ctx *CreateTunnelTer
n := self.appEnv.GetHostController().GetNetwork()
err := n.Terminators.Create(terminator)
if err != nil {
self.returnError(ctx, internalError(err))
return
// terminator might have been created while we were trying to create.
terminator, _ = self.getNetwork().Terminators.Read(ctx.req.Address)
if terminator != nil {
logger.Info("terminator already exists")
} else {
self.returnError(ctx, internalError(err))
return
}
} else {
logger.Info("created terminator")
}
logger.Info("created terminator")
}

response := &edge_ctrl_pb.CreateTunnelTerminatorResponse{
Expand Down

0 comments on commit 431df85

Please sign in to comment.