mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-14 16:03:45 +00:00
p2p: Prevent blocking on the conn.cont channel
Signed-off-by: Lewis Marshall <lewis@lmars.net>
This commit is contained in:
parent
5d8c55b077
commit
2b7a3a379b
1 changed files with 10 additions and 2 deletions
|
|
@ -548,7 +548,11 @@ running:
|
||||||
c.flags |= trustedConn
|
c.flags |= trustedConn
|
||||||
}
|
}
|
||||||
// TODO: track in-progress inbound node IDs (pre-Peer) to avoid dialing them.
|
// TODO: track in-progress inbound node IDs (pre-Peer) to avoid dialing them.
|
||||||
c.cont <- srv.encHandshakeChecks(peers, c)
|
select {
|
||||||
|
case c.cont <- srv.encHandshakeChecks(peers, c):
|
||||||
|
case <-srv.quit:
|
||||||
|
break running
|
||||||
|
}
|
||||||
case c := <-srv.addpeer:
|
case c := <-srv.addpeer:
|
||||||
// At this point the connection is past the protocol handshake.
|
// At this point the connection is past the protocol handshake.
|
||||||
// Its capabilities are known and the remote identity is verified.
|
// Its capabilities are known and the remote identity is verified.
|
||||||
|
|
@ -569,7 +573,11 @@ running:
|
||||||
// The dialer logic relies on the assumption that
|
// The dialer logic relies on the assumption that
|
||||||
// dial tasks complete after the peer has been added or
|
// dial tasks complete after the peer has been added or
|
||||||
// discarded. Unblock the task last.
|
// discarded. Unblock the task last.
|
||||||
c.cont <- err
|
select {
|
||||||
|
case c.cont <- err:
|
||||||
|
case <-srv.quit:
|
||||||
|
break running
|
||||||
|
}
|
||||||
case pd := <-srv.delpeer:
|
case pd := <-srv.delpeer:
|
||||||
// A peer disconnected.
|
// A peer disconnected.
|
||||||
d := common.PrettyDuration(mclock.Now() - pd.created)
|
d := common.PrettyDuration(mclock.Now() - pd.created)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue