Allow handling multiple SOCKS connections simultaneously.

Close the SOCKS connection in the same function that opens it.
This commit is contained in:
David Fifield 2020-01-28 03:10:54 -07:00
parent 20ac2029fd
commit dfb83c6606
2 changed files with 7 additions and 5 deletions

View file

@ -57,10 +57,13 @@ func socksAcceptLoop(ln *pt.SocksListener, snowflakes sf.SnowflakeCollector) {
break
}
log.Printf("SOCKS accepted: %v", conn.Req)
err = sf.Handler(conn, snowflakes)
if err != nil {
log.Printf("handler error: %s", err)
}
go func() {
defer conn.Close()
err = sf.Handler(conn, snowflakes)
if err != nil {
log.Printf("handler error: %s", err)
}
}()
}
}