Skip to content

Commit 143c84d

Browse files
authored
fix: (native conn.go) closeMatch logic should really close all matching conns; closes PacketConn also (#248)
1 parent 65bfd8a commit 143c84d

File tree

1 file changed

+5
-8
lines changed
  • core/src/main/golang/native/tunnel

1 file changed

+5
-8
lines changed

core/src/main/golang/native/tunnel/conn.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,17 @@ func CloseAllConnections() {
1212
})
1313
}
1414

15-
func closeMatch(filter func(conn C.Conn) bool) {
15+
func closeMatch(filter func(conn C.Connection) bool) {
1616
statistic.DefaultManager.Range(func(c statistic.Tracker) bool {
17-
if cc, ok := c.(C.Conn); ok {
18-
if filter(cc) {
19-
_ = cc.Close()
20-
return true
21-
}
17+
if filter(c) {
18+
_ = c.Close()
2219
}
23-
return false
20+
return true
2421
})
2522
}
2623

2724
func closeConnByGroup(name string) {
28-
closeMatch(func(conn C.Conn) bool {
25+
closeMatch(func(conn C.Connection) bool {
2926
for _, c := range conn.Chains() {
3027
if c == name {
3128
return true

0 commit comments

Comments
 (0)