Trivial networking changes for Substrate PR #11940 (#5841)

* Trivial networking changes for Substrate PR https://github.com/paritytech/substrate/pull/11940

* update lockfile for {"substrate"}

Co-authored-by: parity-processbot <>
This commit is contained in:
Nazar Mokrynskyi
2022-08-09 22:37:31 +03:00
committed by GitHub
parent 8a947d4c5d
commit f1dce2f548
10 changed files with 199 additions and 186 deletions
+8 -9
View File
@@ -25,6 +25,9 @@ use sc_network::{
config::parse_addr, multiaddr::Multiaddr, Event as NetworkEvent, IfDisconnected,
NetworkService, OutboundFailure, RequestFailure,
};
use sc_network_common::service::{
NetworkEventStream, NetworkNotification, NetworkPeers, NetworkRequest,
};
use polkadot_node_network_protocol::{
peer_set::PeerSet,
@@ -121,27 +124,23 @@ impl Network for Arc<NetworkService<Block, Hash>> {
protocol: Cow<'static, str>,
multiaddresses: HashSet<Multiaddr>,
) -> Result<(), String> {
sc_network::NetworkService::set_reserved_peers(&**self, protocol, multiaddresses)
NetworkService::set_reserved_peers(&**self, protocol, multiaddresses)
}
async fn remove_from_peers_set(&mut self, protocol: Cow<'static, str>, peers: Vec<PeerId>) {
sc_network::NetworkService::remove_peers_from_reserved_set(&**self, protocol, peers);
NetworkService::remove_peers_from_reserved_set(&**self, protocol, peers);
}
fn report_peer(&self, who: PeerId, cost_benefit: Rep) {
sc_network::NetworkService::report_peer(&**self, who, cost_benefit.into_base_rep());
NetworkService::report_peer(&**self, who, cost_benefit.into_base_rep());
}
fn disconnect_peer(&self, who: PeerId, peer_set: PeerSet) {
sc_network::NetworkService::disconnect_peer(
&**self,
who,
peer_set.into_default_protocol_name(),
);
NetworkService::disconnect_peer(&**self, who, peer_set.into_default_protocol_name());
}
fn write_notification(&self, who: PeerId, peer_set: PeerSet, message: Vec<u8>) {
sc_network::NetworkService::write_notification(
NetworkService::write_notification(
&**self,
who,
peer_set.into_default_protocol_name(),
+2 -2
View File
@@ -236,7 +236,7 @@ impl TestSyncOracleHandle {
}
impl SyncOracle for TestSyncOracle {
fn is_major_syncing(&mut self) -> bool {
fn is_major_syncing(&self) -> bool {
let is_major_syncing = self.is_major_syncing.load(Ordering::SeqCst);
if !is_major_syncing {
@@ -248,7 +248,7 @@ impl SyncOracle for TestSyncOracle {
is_major_syncing
}
fn is_offline(&mut self) -> bool {
fn is_offline(&self) -> bool {
unimplemented!("not used in network bridge")
}
}