mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2024-11-16 14:32:17 +08:00
fix: (native conn.go) closeMatch
logic should really close all matching conns; closes PacketConn also (#248)
This commit is contained in:
parent
65bfd8a132
commit
143c84d47b
|
@ -12,20 +12,17 @@ func CloseAllConnections() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func closeMatch(filter func(conn C.Conn) bool) {
|
func closeMatch(filter func(conn C.Connection) bool) {
|
||||||
statistic.DefaultManager.Range(func(c statistic.Tracker) bool {
|
statistic.DefaultManager.Range(func(c statistic.Tracker) bool {
|
||||||
if cc, ok := c.(C.Conn); ok {
|
if filter(c) {
|
||||||
if filter(cc) {
|
_ = c.Close()
|
||||||
_ = cc.Close()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false
|
return true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func closeConnByGroup(name string) {
|
func closeConnByGroup(name string) {
|
||||||
closeMatch(func(conn C.Conn) bool {
|
closeMatch(func(conn C.Connection) bool {
|
||||||
for _, c := range conn.Chains() {
|
for _, c := range conn.Chains() {
|
||||||
if c == name {
|
if c == name {
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in New Issue
Block a user