chore: avoid unneeded map copy when close connection in restful api

This commit is contained in:
wwqgtxx
2023-06-26 17:46:14 +08:00
parent 2284acce94
commit 42ef4fedfa
4 changed files with 24 additions and 18 deletions

View File

@ -147,15 +147,15 @@ func (pp *proxySetProvider) getSubscriptionInfo() {
}
func (pp *proxySetProvider) closeAllConnections() {
snapshot := statistic.DefaultManager.Snapshot()
for _, c := range snapshot.Connections {
statistic.DefaultManager.ConnectionsRange(func(c statistic.Tracker) bool {
for _, chain := range c.Chains() {
if chain == pp.Name() {
_ = c.Close()
break
}
}
}
return true
})
}
func stopProxyProvider(pd *ProxySetProvider) {