From 94e4370c7e2c477fc4eca0dd9e730be8e4096684 Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Fri, 11 Nov 2016 22:28:46 +0000 Subject: [PATCH] cmd/strelaysrv: Outbox will get GCed (fixes #3718) --- cmd/strelaysrv/listener.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cmd/strelaysrv/listener.go b/cmd/strelaysrv/listener.go index db7ef1921..db8af5b04 100644 --- a/cmd/strelaysrv/listener.go +++ b/cmd/strelaysrv/listener.go @@ -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) }