Hysteria client: Release client map lock before cleanup (#7122)

https://github.com/XTLS/Xray-core/pull/7122#issuecomment-6119280343
This commit is contained in:
SVLAVR
2026-10-12 06:56:24 +00:00
committed by GitHub
parent fb2dcedbb7
commit 2bea2df6a1
+8 -10
View File
@@ -300,23 +300,21 @@ type clientManager struct {
func (m *clientManager) clean() {
ticker := time.NewTicker(idleCleanupInterval)
for range ticker.C {
var forced []dialerConf
m.RLock()
entries := make(map[dialerConf]*client, len(m.m))
for k, c := range m.m {
entries[k] = c
}
m.RUnlock()
for k, c := range entries {
force := c.instance != nil && !c.instance.IsRunning()
c.clean(force)
if force {
forced = append(forced, k)
m.Lock()
delete(m.m, k)
m.Unlock()
}
}
m.RUnlock()
for i := range forced {
m.Lock()
delete(m.m, forced[i])
m.Unlock()
}
}
}