mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-02 11:15:03 +03:00
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:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user