Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion beacon_node/network/src/router/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ use types::EthSpec;
/// passing them to the internal message processor. The message processor spawns a syncing thread
/// which manages which blocks need to be requested and processed.
pub struct Router<T: BeaconChainTypes> {
/// Access to the peer db.
network_globals: Arc<NetworkGlobals<T::EthSpec>>,
/// Processes validated and decoded messages from the network. Has direct access to the
/// sync manager.
processor: Processor<T>,
Expand Down Expand Up @@ -83,13 +85,14 @@ impl<T: BeaconChainTypes> Router<T> {
let processor = Processor::new(
executor.clone(),
beacon_chain,
network_globals,
network_globals.clone(),
network_send,
&log,
);

// generate the Message handler
let mut handler = Router {
network_globals,
processor,
log: message_handler_log,
};
Expand Down Expand Up @@ -150,6 +153,10 @@ impl<T: BeaconChainTypes> Router<T> {

/// A new RPC request has been received from the network.
fn handle_rpc_request(&mut self, peer_id: PeerId, id: PeerRequestId, request: Request) {
if !self.network_globals.peers.read().is_connected(&peer_id) {
debug!(self.log, "Dropping request of disconnected peer"; "peer_id" => %peer_id, "request" => ?request);
return;
}
match request {
Request::Status(status_message) => {
self.processor
Expand Down