From 143c84d47b6e636195bbdc8ca89b8617c84e4196 Mon Sep 17 00:00:00 2001 From: Shun Zi <20991618+shunf4@users.noreply.github.com> Date: Tue, 30 Jul 2024 13:26:57 +0800 Subject: [PATCH] fix: (native conn.go) `closeMatch` logic should really close all matching conns; closes PacketConn also (#248) --- core/src/main/golang/native/tunnel/conn.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/core/src/main/golang/native/tunnel/conn.go b/core/src/main/golang/native/tunnel/conn.go index 98c9061f3..a57131d01 100644 --- a/core/src/main/golang/native/tunnel/conn.go +++ b/core/src/main/golang/native/tunnel/conn.go @@ -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