Commit 6a9c2bf9 authored by David Fifield's avatar David Fifield
Browse files

Don't log "SOCKS accepted" if there was an Accept error.

This actually caused a nil pointer dereference panic when Accept
returned an error, because conn was nil.
parent 1114acbc
...@@ -57,13 +57,13 @@ func socksAcceptLoop(ln *pt.SocksListener, snowflakes SnowflakeCollector) error ...@@ -57,13 +57,13 @@ func socksAcceptLoop(ln *pt.SocksListener, snowflakes SnowflakeCollector) error
for { for {
log.Println("SOCKS listening...") log.Println("SOCKS listening...")
conn, err := ln.AcceptSocks() conn, err := ln.AcceptSocks()
log.Println("SOCKS accepted: ", conn.Req)
if err != nil { if err != nil {
if e, ok := err.(net.Error); ok && e.Temporary() { if e, ok := err.(net.Error); ok && e.Temporary() {
continue continue
} }
return err return err
} }
log.Println("SOCKS accepted: ", conn.Req)
err = handler(conn, snowflakes) err = handler(conn, snowflakes)
if err != nil { if err != nil {
log.Printf("handler error: %s", err) log.Printf("handler error: %s", err)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment