Skip to content

Commit

Permalink
Rename open_peer() to connected_peers()
Browse files Browse the repository at this point in the history
  • Loading branch information
shamil-gadelshin committed May 1, 2024
1 parent 24a8efa commit be247a2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions substrate/client/network/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,12 +744,12 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkService<B, H> {
}

/// Returns a collection of currently connected (open) peers.
pub async fn open_peers(&self) -> Result<Vec<PeerId>, ()> {
pub async fn connected_peers(&self) -> Result<Vec<PeerId>, ()> {
let (tx, rx) = oneshot::channel();

let _ = self
.to_worker
.unbounded_send(ServiceToWorkerMsg::OpenPeers { pending_response: tx });
.unbounded_send(ServiceToWorkerMsg::ConnectedPeers { pending_response: tx });

match rx.await {
Ok(v) => Ok(v),
Expand Down Expand Up @@ -1188,7 +1188,7 @@ enum ServiceToWorkerMsg {
NetworkState {
pending_response: oneshot::Sender<Result<NetworkState, RequestFailure>>,
},
OpenPeers {
ConnectedPeers {
pending_response: oneshot::Sender<Vec<PeerId>>,
},
DisconnectPeer(PeerId, ProtocolName),
Expand Down Expand Up @@ -1333,13 +1333,13 @@ where
.behaviour_mut()
.user_protocol_mut()
.disconnect_peer(&who, protocol_name),
ServiceToWorkerMsg::OpenPeers { pending_response } => {
let _ = pending_response.send(self.open_peers());
ServiceToWorkerMsg::ConnectedPeers { pending_response } => {
let _ = pending_response.send(self.connected_peers());
},
}
}

fn open_peers(&self) -> Vec<PeerId> {
fn connected_peers(&self) -> Vec<PeerId> {
self.network_service
.behaviour()
.user_protocol()
Expand Down

0 comments on commit be247a2

Please sign in to comment.