cmd/strelaysrv: Outbox will get GCed (fixes #3718)

This commit is contained in:
Audrius Butkevicius 2016-11-11 22:28:46 +00:00 committed by Jakob Borg
parent 38d28c3f4a
commit 94e4370c7e

View File

@ -172,7 +172,7 @@ func protocolConnectionHandler(tcpConn net.Conn, config *tls.Config) {
if debug {
log.Println("Sent invitation from", id, "to", requestedPeer)
}
default:
case <-time.After(time.Second):
if debug {
log.Println("Could not send invitation from", id, "to", requestedPeer, "as peer disconnected")
}
@ -204,7 +204,6 @@ func protocolConnectionHandler(tcpConn net.Conn, config *tls.Config) {
if debug {
log.Printf("Closing connection %s: %s", id, err)
}
close(outbox)
// Potentially closing a second time.
conn.Close()
@ -260,10 +259,6 @@ func protocolConnectionHandler(tcpConn net.Conn, config *tls.Config) {
conn.Close()
case msg := <-outbox:
if msg == nil {
conn.Close()
return
}
if debug {
log.Printf("Sending message %T to %s", msg, id)
}