Skip to content

Commit

Permalink
fix: (native conn.go) closeMatch logic should really close all matc…
Browse files Browse the repository at this point in the history
…hing conns; closes PacketConn also (#248)
  • Loading branch information
shunf4 authored Jul 30, 2024
1 parent 65bfd8a commit 143c84d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions core/src/main/golang/native/tunnel/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 143c84d

Please sign in to comment.