fix: 流量用户为null,xray无法断开失效用户连接

This commit is contained in:
wyx2685
2025-09-18 20:39:18 +09:00
parent 4ed6bc6d87
commit 65f2de55ea
3 changed files with 109 additions and 60 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/InazumaV/V2bX/common/counter"
"github.com/InazumaV/V2bX/common/format"
vCore "github.com/InazumaV/V2bX/core"
"github.com/InazumaV/V2bX/core/xray/app/dispatcher"
"github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/proxy"
)
@@ -43,8 +44,15 @@ func (c *Xray) DelUsers(users []panel.UserInfo, tag string, _ *panel.NodeInfo) e
return err
}
delete(c.users.uidMap, user)
c.dispatcher.Counter.Delete(user)
c.dispatcher.Wm.RemoveWritersForUser(user)
if v, ok := c.dispatcher.Counter.Load(tag); ok {
tc := v.(*counter.TrafficCounter)
tc.Delete(user)
}
if v, ok := c.dispatcher.LinkManagers.Load(user); ok {
lm := v.(*dispatcher.LinkManager)
lm.CloseAll()
c.dispatcher.LinkManagers.Delete(user)
}
}
return nil
}