mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2024-11-16 02:42:18 +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 {
|
||||
if cc, ok := c.(C.Conn); ok {
|
||||
if filter(cc) {
|
||||
_ = cc.Close()
|
||||
return true
|
||||
}
|
||||
if filter(c) {
|
||||
_ = c.Close()
|
||||
}
|
||||
return false
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
func closeConnByGroup(name string) {
|
||||
closeMatch(func(conn C.Conn) bool {
|
||||
closeMatch(func(conn C.Connection) bool {
|
||||
for _, c := range conn.Chains() {
|
||||
if c == name {
|
||||
return true
|
||||
|
|
Loading…
Reference in New Issue
Block a user