From 8e965f828b8122c8c819d42a2a122b1d60a2645c Mon Sep 17 00:00:00 2001 From: lanxuage Date: Wed, 1 Mar 2023 14:39:46 +0800 Subject: [PATCH] fix(socks): Fix the problem that wg.wait() is invalid due to the early termination of the main process before the coordination process executes wg.add(1). --- cmd/socks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/socks.go b/cmd/socks.go index b2ac40b..c1ea873 100644 --- a/cmd/socks.go +++ b/cmd/socks.go @@ -26,8 +26,8 @@ var socksCmd = &cobra.Command{ key := randomString(socks.KeyLength) var wg sync.WaitGroup + wg.Add(1) go func() { - wg.Add(1) defer wg.Done() socks.Serve(lp, sp, key) }()