Skip to content

Agent Mesh

node: announce the services again whenever a router is attached

Antonio Ojea900d656bfbfc
diff --git a/internal/node/node.go b/internal/node/node.go
index 6a09c92a..174c94a1 100644
--- a/internal/node/node.go
+++ b/internal/node/node.go
@@ -1131,6 +1131,7 @@ func (n *AgentMeshNode) redialRouter(ctx context.Context, router peer.ID) {
err := n.authRouter(ctx, peer.AddrInfo{ID: router, Addrs: addrs}, biscuitBytes)
if err == nil {
logger.Infof("[AuthN] Router %s re-admitted this node on redial %d", router, attempt)
+ // A router that restarted lost this node's records.
n.triggerReprovide()
return
}
diff --git a/internal/node/routers.go b/internal/node/routers.go
index 7f1ba033..2e1cf4ea 100644
--- a/internal/node/routers.go
+++ b/internal/node/routers.go
@@ -243,6 +243,9 @@ func (n *AgentMeshNode) attach(router peer.ID) {
n.connMgr.Protect(router, routerTag)
}
n.refreshRelays()
+ // A router to announce to: services registered before this one was
+ // held, as the egress assignments are at start, go to the directory now.
+ n.triggerReprovide()
}
// detach gives a router up: the node stops redialling it and lets the
@@ -363,11 +366,7 @@ func (n *AgentMeshNode) topUpRouters(ctx context.Context) int {
for range targets {
<-results
}
- after := n.AttachedRouters()
- if after > have {
- n.triggerReprovide()
- }
- return after
+ return n.AttachedRouters()
}
// TopUp attaches to more routers from what the node knows and returns how