fix(node): drop a swept inbound's bookkeeping from the node runtime

The node Remote keeps a fingerprint, a remote id and possibly an alias
per inbound tag. When the master swept an inbound the node stopped
reporting, those entries stayed, so a node rotating tags grew the maps
for as long as the master ran. The sweep now hands every removed tag to
Remote.ForgetInbound, which drops all of it in both tag forms, and a
master-driven delete uses it too. The sweep's call is wiring;
TestRemoteForgetInboundDropsEveryTrace covers what it drops.
This commit is contained in:
MHSanaei
2026-10-31 09:28:39 +00:00
parent d4b80b5d80
commit fd3fa86982
4 changed files with 41 additions and 2 deletions
+6 -1
View File
@@ -704,6 +704,7 @@ func (s *InboundService) setRemoteTrafficLocked(nodeID int, snap *runtime.Traffi
structuralChange := false
lifecycleLifted := false
var sweptTags []string
var adoptedInbounds []*model.Inbound
type pendingAdopt struct {
@@ -1036,6 +1037,7 @@ func (s *InboundService) setRemoteTrafficLocked(nodeID int, snap *runtime.Traffi
return false, err
}
delete(tagToCentral, c.Tag)
sweptTags = append(sweptTags, c.Tag)
structuralChange = true
}
@@ -1480,13 +1482,16 @@ func (s *InboundService) setRemoteTrafficLocked(nodeID int, snap *runtime.Traffi
}
}
if len(adoptedInbounds) > 0 {
if len(adoptedInbounds) > 0 || len(sweptTags) > 0 {
if mgr := runtime.GetManager(); mgr != nil {
if rt, rtErr := mgr.RuntimeFor(&nodeID); rtErr == nil {
if rem, ok := rt.(*runtime.Remote); ok {
for _, ib := range adoptedInbounds {
rem.RecordAdoptedInbound(ib)
}
for _, tag := range sweptTags {
rem.ForgetInbound(tag)
}
}
}
}