[tor-commits] [snowflake/master] Pass lock to socksAcceptLoop by reference

cohosh at torproject.org cohosh at torproject.org
Wed Dec 16 15:53:55 UTC 2020


commit 8ec8a7cb635f1eaf36eadff06c653e73fe553817
Author: Cecylia Bocovich <cohosh at torproject.org>
Date:   Wed Dec 16 10:52:19 2020 -0500

    Pass lock to socksAcceptLoop by reference
    
    This fixes a bug where we were passing the lock by value to
    socksAcceptLoop.
---
 client/snowflake.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/client/snowflake.go b/client/snowflake.go
index 55addc1..e293e73 100644
--- a/client/snowflake.go
+++ b/client/snowflake.go
@@ -28,7 +28,7 @@ const (
 )
 
 // Accept local SOCKS connections and pass them to the handler.
-func socksAcceptLoop(ln *pt.SocksListener, tongue sf.Tongue, shutdown chan struct{}, wg sync.WaitGroup) {
+func socksAcceptLoop(ln *pt.SocksListener, tongue sf.Tongue, shutdown chan struct{}, wg *sync.WaitGroup) {
 	defer ln.Close()
 	for {
 		conn, err := ln.AcceptSocks()
@@ -187,7 +187,7 @@ func main() {
 				break
 			}
 			log.Printf("Started SOCKS listener at %v.", ln.Addr())
-			go socksAcceptLoop(ln, dialer, shutdown, wg)
+			go socksAcceptLoop(ln, dialer, shutdown, &wg)
 			pt.Cmethod(methodName, ln.Version(), ln.Addr())
 			listeners = append(listeners, ln)
 		default:



More information about the tor-commits mailing list