From 5ee7746aab881d05d03c73655e18c915d9230f7c Mon Sep 17 00:00:00 2001 From: ginuerzh Date: Sun, 28 Jan 2024 18:56:19 +0800 Subject: [PATCH] fix tunnel connector selection --- handler/tunnel/tunnel.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/handler/tunnel/tunnel.go b/handler/tunnel/tunnel.go index 467ade8..7d3d432 100644 --- a/handler/tunnel/tunnel.go +++ b/handler/tunnel/tunnel.go @@ -121,7 +121,6 @@ func (t *Tunnel) GetConnector(network string) *Connector { rw.Reset() found := false - var connectors []*Connector for _, c := range t.connectors { if c.Session().IsClosed() { continue @@ -135,19 +134,15 @@ func (t *Tunnel) GetConnector(network string) *Connector { if network == "udp" && c.id.IsUDP() || network != "udp" && !c.id.IsUDP() { if weight == MaxWeight && !found { - connectors = nil + rw.Reset() found = true } if weight == MaxWeight || !found { - connectors = append(connectors, c) rw.Add(c, int(weight)) } } } - if len(connectors) == 0 { - return nil - } return rw.Next() }