mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
p2p: simplify checkpoint handling
There is no need to select on srv.quit for both ends of the checkpoint channel.
This commit is contained in:
parent
3be913743a
commit
3b6d9788d5
1 changed files with 4 additions and 16 deletions
|
|
@ -731,11 +731,8 @@ running:
|
|||
c.flags |= trustedConn
|
||||
}
|
||||
// TODO: track in-progress inbound node IDs (pre-Peer) to avoid dialing them.
|
||||
select {
|
||||
case c.cont <- srv.postHandshakeChecks(peers, inboundCount, c):
|
||||
case <-srv.quit:
|
||||
break running
|
||||
}
|
||||
c.cont <- srv.postHandshakeChecks(peers, inboundCount, c)
|
||||
|
||||
case c := <-srv.checkpointAddPeer:
|
||||
// At this point the connection is past the protocol handshake.
|
||||
// Its capabilities are known and the remote identity is verified.
|
||||
|
|
@ -759,11 +756,7 @@ running:
|
|||
// The dialer logic relies on the assumption that
|
||||
// dial tasks complete after the peer has been added or
|
||||
// discarded. Unblock the task last.
|
||||
select {
|
||||
case c.cont <- err:
|
||||
case <-srv.quit:
|
||||
break running
|
||||
}
|
||||
c.cont <- err
|
||||
|
||||
case pd := <-srv.delpeer:
|
||||
// A peer disconnected.
|
||||
|
|
@ -1012,12 +1005,7 @@ func (srv *Server) checkpoint(c *conn, stage chan<- *conn) error {
|
|||
case <-srv.quit:
|
||||
return errServerStopped
|
||||
}
|
||||
select {
|
||||
case err := <-c.cont:
|
||||
return err
|
||||
case <-srv.quit:
|
||||
return errServerStopped
|
||||
}
|
||||
return <-c.cont
|
||||
}
|
||||
|
||||
// runPeer runs in its own goroutine for each peer.
|
||||
|
|
|
|||
Loading…
Reference in a new issue