From 79a6782c1c4a056b27d2c242f656dfcf5633ae3f Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 13 Apr 2015 17:06:19 +0200 Subject: [PATCH] p2p: fix goroutine leak when handshake read fails This regression was introduced in b3c058a9e4e9. --- p2p/handshake.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p2p/handshake.go b/p2p/handshake.go index 43361364fa..79395f23ff 100644 --- a/p2p/handshake.go +++ b/p2p/handshake.go @@ -115,7 +115,7 @@ func setupOutboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake, // returning the handshake read error. If the remote side // disconnects us early with a valid reason, we should return it // as the error so it can be tracked elsewhere. - werr := make(chan error) + werr := make(chan error, 1) go func() { werr <- Send(rw, handshakeMsg, our) }() rhs, err := readProtocolHandshake(rw, secrets.RemoteID, our) if err != nil {