From 9fb3940653c56b5317c47315752efe23aac3061f Mon Sep 17 00:00:00 2001 From: lanxuage Date: Thu, 9 Mar 2023 12:48:25 +0800 Subject: [PATCH] Fix the conflict between global variable sessions in socks/socks.go and local variable session in pickConn function of socks/socks.go. Signed-off-by: lanxuage --- socks/socks.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/socks/socks.go b/socks/socks.go index 56b2a79..557825a 100644 --- a/socks/socks.go +++ b/socks/socks.go @@ -61,7 +61,7 @@ func listenClient(port string) { } func forward(conn net.Conn) { - scfConn := pickConn(sessions) + scfConn := pickConn() _forward := func(src, dest net.Conn) { defer src.Close() @@ -74,7 +74,7 @@ func forward(conn net.Conn) { } -func pickConn(sessions []*yamux.Session) net.Conn { +func pickConn() net.Conn { for { l := len(sessions) if l == 0 {