mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-03 14:52:55 +00:00
p2p: fix close data race
This commit is contained in:
parent
ca8cb65b73
commit
ff84352fb7
1 changed files with 1 additions and 0 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue