Commit 79a6782c authored by Felix Lange's avatar Felix Lange

p2p: fix goroutine leak when handshake read fails

This regression was introduced in b3c058a9.
parent faa27478
...@@ -115,7 +115,7 @@ func setupOutboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake, ...@@ -115,7 +115,7 @@ func setupOutboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake,
// returning the handshake read error. If the remote side // returning the handshake read error. If the remote side
// disconnects us early with a valid reason, we should return it // disconnects us early with a valid reason, we should return it
// as the error so it can be tracked elsewhere. // 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) }() go func() { werr <- Send(rw, handshakeMsg, our) }()
rhs, err := readProtocolHandshake(rw, secrets.RemoteID, our) rhs, err := readProtocolHandshake(rw, secrets.RemoteID, our)
if err != nil { if err != nil {
......
Markdown is supported
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