Log to io.Discard if no log file is set.

https://bugs.torproject.org/25600#comment:14

Snowflake in Tor Browser has been hanging after surfing for a while.
(Tor reports "no running bridges".) It only began happening after commit
12922a232b, which caused snowflake-client not to log to a file by
default (leaving it to log to its default stderr). What seems to be
happening is that tor doesn't read from its PT clients' stderr, leaving
a buffer to fill up that eventually causes a hang.
This commit is contained in:
David Fifield 2018-06-10 16:41:32 -07:00
parent 25b304a9a8
commit 6077141f4a

View file

@ -150,6 +150,8 @@ func main() {
}
defer logFile.Close()
log.SetOutput(logFile)
} else {
log.SetOutput(ioutil.Discard)
}
log.Println("\n\n\n --- Starting Snowflake Client ---")