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.
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: