From ff84352fb73bdbb07a7b2cf24b417927bf5a5c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 9 Jun 2015 16:05:40 +0300 Subject: p2p: fix close data race --- p2p/rlpx.go | 1 + 1 file changed, 1 insertion(+) diff --git a/p2p/rlpx.go b/p2p/rlpx.go index e1cb13aae..6bbf20671 100644 --- a/p2p/rlpx.go +++ b/p2p/rlpx.go @@ -102,6 +102,7 @@ func (t *rlpx) doProtoHandshake(our *protoHandshake) (their *protoHandshake, err werr := make(chan error, 1) go func() { werr <- Send(t.rw, handshakeMsg, our) }() if their, err = readProtocolHandshake(t.rw, our); err != nil { + <-werr // make sure the write terminates too return nil, err } if err := <-werr; err != nil { -- cgit v1.2.3