Commit ff84352f authored by Péter Szilágyi's avatar Péter Szilágyi

p2p: fix close data race

parent ca8cb65b
...@@ -102,6 +102,7 @@ func (t *rlpx) doProtoHandshake(our *protoHandshake) (their *protoHandshake, err ...@@ -102,6 +102,7 @@ func (t *rlpx) doProtoHandshake(our *protoHandshake) (their *protoHandshake, err
werr := make(chan error, 1) werr := make(chan error, 1)
go func() { werr <- Send(t.rw, handshakeMsg, our) }() go func() { werr <- Send(t.rw, handshakeMsg, our) }()
if their, err = readProtocolHandshake(t.rw, our); err != nil { if their, err = readProtocolHandshake(t.rw, our); err != nil {
<-werr // make sure the write terminates too
return nil, err return nil, err
} }
if err := <-werr; err != nil { if err := <-werr; 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