Skip to content

Commit

Permalink
add auto relay only when the relay and relayed nodes are in the same …
Browse files Browse the repository at this point in the history
…network
  • Loading branch information
yabinma committed Dec 11, 2024
1 parent 70ffdef commit cd89362
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions auth/host_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func CheckNetRegAndHostUpdate(networks []string, h *models.Host, relayNodeId uui
if relayNodeId != uuid.Nil && !newNode.IsRelayed {
// check if relay node exists and acting as relay
relaynode, err := logic.GetNodeByID(relayNodeId.String())
if err == nil && relaynode.IsRelay {
if err == nil && relaynode.IsRelay && relaynode.Network == newNode.Network {
slog.Info(fmt.Sprintf("adding relayed node %s to relay %s on network %s", newNode.ID.String(), relayNodeId.String(), network))
newNode.IsRelayed = true
newNode.RelayedBy = relayNodeId.String()
Expand All @@ -271,7 +271,7 @@ func CheckNetRegAndHostUpdate(networks []string, h *models.Host, relayNodeId uui
slog.Error("failed to update node", "nodeid", relayNodeId.String())
}
} else {
slog.Error("failed to relay node. maybe specified relay node is actually not a relay?", "err", err)
slog.Error("failed to relay node. maybe specified relay node is actually not a relay? Or the relayed node is not in the same network with relay?", "err", err)
}
}
logger.Log(1, "added new node", newNode.ID.String(), "to host", h.Name)
Expand Down

0 comments on commit cd89362

Please sign in to comment.