diff --git a/p2p/server.go b/p2p/server.go index b103084f03..06dc95f222 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -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.