Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BanPeer implementation #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion spectrum-network/src/network_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::time::{Duration, Instant};
use either::{Either, Left, Right};
use futures::channel::mpsc::{Receiver, Sender};
use futures::{SinkExt, Stream};
use libp2p::allow_block_list::{Behaviour, BlockedPeers};
use libp2p::core::Endpoint;
use libp2p::swarm::behaviour::ConnectionEstablished;
use libp2p::swarm::{
Expand Down Expand Up @@ -262,6 +263,7 @@ pub struct NetworkController<TPeers, TPeerManager, THandler> {
pending_one_shot_requests: HashMap<PeerId, OneShotMessage>,
requests_recv: Receiver<NetworkControllerIn>,
pending_actions: VecDeque<ToSwarm<NetworkControllerOut, ConnHandlerIn>>,
blocked_list: Behaviour<BlockedPeers>,
}

impl<TPeers, TPeerManager, THandler> NetworkController<TPeers, TPeerManager, THandler>
Expand All @@ -284,6 +286,7 @@ where
pending_one_shot_requests: HashMap::new(),
requests_recv,
pending_actions: VecDeque::new(),
blocked_list: Behaviour::default(),
}
}

Expand Down Expand Up @@ -819,7 +822,7 @@ where
}
}
NetworkControllerIn::BanPeer(pid) => {
//todo: Ban peer; DEV-941
self.blocked_list.block_peer(pid);
}
}
continue;
Expand Down