Skip to content

Commit

Permalink
Merge pull request #3218 from gravitl/release-v0.26.0
Browse files Browse the repository at this point in the history
Release v0.26.0
  • Loading branch information
abhishek9686 authored Nov 23, 2024
2 parents efc243b + dbb44c2 commit 208cbd3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions pro/controllers/failover.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ func failOverME(w http.ResponseWriter, r *http.Request) {
)
return
}
if peerNode.IsFailOver {
logic.ReturnErrorResponse(
w,
r,
logic.FormatError(errors.New("peer is acting as failover"), "badrequest"),
)
return
}
if node.IsRelayed && node.RelayedBy == peerNode.ID.String() {
logic.ReturnErrorResponse(
w,
Expand Down
6 changes: 5 additions & 1 deletion pro/logic/failover.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package logic
import (
"errors"
"net"
"sync"

"github.com/google/uuid"
"github.com/gravitl/netmaker/logger"
Expand All @@ -11,8 +12,11 @@ import (
"golang.org/x/exp/slog"
)

func SetFailOverCtx(failOverNode, victimNode, peerNode models.Node) error {
var failOverCtxMutex = &sync.RWMutex{}

func SetFailOverCtx(failOverNode, victimNode, peerNode models.Node) error {
failOverCtxMutex.Lock()
defer failOverCtxMutex.Unlock()
if peerNode.FailOverPeers == nil {
peerNode.FailOverPeers = make(map[string]struct{})
}
Expand Down

0 comments on commit 208cbd3

Please sign in to comment.