aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-06-09 21:05:40 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-06-09 21:12:24 +0800
commitff84352fb73bdbb07a7b2cf24b417927bf5a5c5e (patch)
tree8801c98f449f703df6af94a5809fed9377d4f2b4
parentca8cb65b73b5bdb6a30b6a45304b3c45acc66bcc (diff)
downloaddexon-ff84352fb73bdbb07a7b2cf24b417927bf5a5c5e.tar
dexon-ff84352fb73bdbb07a7b2cf24b417927bf5a5c5e.tar.gz
dexon-ff84352fb73bdbb07a7b2cf24b417927bf5a5c5e.tar.bz2
dexon-ff84352fb73bdbb07a7b2cf24b417927bf5a5c5e.tar.lz
dexon-ff84352fb73bdbb07a7b2cf24b417927bf5a5c5e.tar.xz
dexon-ff84352fb73bdbb07a7b2cf24b417927bf5a5c5e.tar.zst
dexon-ff84352fb73bdbb07a7b2cf24b417927bf5a5c5e.zip
p2p: fix close data race
-rw-r--r--p2p/rlpx.go1
1 files changed, 1 insertions, 0 deletions
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 {