Pass lock to socksAcceptLoop by reference

This fixes a bug where we were passing the lock by value to
socksAcceptLoop.
This commit is contained in:
Cecylia Bocovich 2020-12-16 10:52:19 -05:00
parent 3e8947bfc9
commit 8ec8a7cb63

View file

@ -28,7 +28,7 @@ const (
) )
// Accept local SOCKS connections and pass them to the handler. // 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() defer ln.Close()
for { for {
conn, err := ln.AcceptSocks() conn, err := ln.AcceptSocks()
@ -187,7 +187,7 @@ func main() {
break break
} }
log.Printf("Started SOCKS listener at %v.", ln.Addr()) 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()) pt.Cmethod(methodName, ln.Version(), ln.Addr())
listeners = append(listeners, ln) listeners = append(listeners, ln)
default: default: