*: Remove inject_connected / inject_disconnected from docs (#2805)

This commit is contained in:
Kourosh
2022-08-10 12:50:31 +04:30
committed by GitHub
parent 1012579d77
commit a4110a2b69
3 changed files with 11 additions and 16 deletions

View File

@ -3335,7 +3335,7 @@ where
)); ));
} else if let Some(conn) = self.connected_peers.get_mut(&propagation_source) { } else if let Some(conn) = self.connected_peers.get_mut(&propagation_source) {
// Only change the value if the old value is Floodsub (the default set in // Only change the value if the old value is Floodsub (the default set in
// inject_connected). All other PeerKind changes are ignored. // inject_connection_established). All other PeerKind changes are ignored.
debug!( debug!(
"New peer type found: {} for peer: {}", "New peer type found: {} for peer: {}",
kind, propagation_source kind, propagation_source

View File

@ -205,8 +205,7 @@ pub trait NetworkBehaviour: 'static {
/// Informs the behaviour about a closed connection to a peer. /// Informs the behaviour about a closed connection to a peer.
/// ///
/// A call to this method is always paired with an earlier call to /// A call to this method is always paired with an earlier call to
/// `inject_connection_established` with the same peer ID, connection ID and /// [`NetworkBehaviour::inject_connection_established`] with the same peer ID, connection ID and endpoint.
/// endpoint.
fn inject_connection_closed( fn inject_connection_closed(
&mut self, &mut self,
_: &PeerId, _: &PeerId,
@ -230,8 +229,8 @@ pub trait NetworkBehaviour: 'static {
/// Informs the behaviour about an event generated by the handler dedicated to the peer identified by `peer_id`. /// Informs the behaviour about an event generated by the handler dedicated to the peer identified by `peer_id`.
/// for the behaviour. /// for the behaviour.
/// ///
/// The `peer_id` is guaranteed to be in a connected state. In other words, `inject_connected` /// The `peer_id` is guaranteed to be in a connected state. In other words,
/// has previously been called with this `PeerId`. /// [`NetworkBehaviour::inject_connection_established`] has previously been called with this `PeerId`.
fn inject_event( fn inject_event(
&mut self, &mut self,
peer_id: PeerId, peer_id: PeerId,

View File

@ -1701,13 +1701,12 @@ mod tests {
/// after which one peer bans the other. /// after which one peer bans the other.
/// ///
/// The test expects both behaviours to be notified via pairs of /// The test expects both behaviours to be notified via pairs of
/// inject_connected / inject_disconnected as well as /// [`NetworkBehaviour::inject_connection_established`] / [`NetworkBehaviour::inject_connection_closed`]
/// inject_connection_established / inject_connection_closed calls /// calls while unbanned.
/// while unbanned.
/// ///
/// While the ban is in effect, further dials occur. For these connections no /// While the ban is in effect, further dials occur. For these connections no
/// `inject_connected`, `inject_connection_established`, `inject_disconnected`, /// [`NetworkBehaviour::inject_connection_established`], [`NetworkBehaviour::inject_connection_closed`]
/// `inject_connection_closed` calls should be registered. /// calls should be registered.
#[test] #[test]
fn test_connect_disconnect_ban() { fn test_connect_disconnect_ban() {
// Since the test does not try to open any substreams, we can // Since the test does not try to open any substreams, we can
@ -1827,8 +1826,7 @@ mod tests {
/// after which one peer disconnects the other using [`Swarm::disconnect_peer_id`]. /// after which one peer disconnects the other using [`Swarm::disconnect_peer_id`].
/// ///
/// The test expects both behaviours to be notified via pairs of /// The test expects both behaviours to be notified via pairs of
/// inject_connected / inject_disconnected as well as /// [`NetworkBehaviour::inject_connection_established`] / [`NetworkBehaviour::inject_connection_closed`] calls.
/// inject_connection_established / inject_connection_closed calls.
#[test] #[test]
fn test_swarm_disconnect() { fn test_swarm_disconnect() {
// Since the test does not try to open any substreams, we can // Since the test does not try to open any substreams, we can
@ -1896,8 +1894,7 @@ mod tests {
/// using [`NetworkBehaviourAction::CloseConnection`] returned by a [`NetworkBehaviour`]. /// using [`NetworkBehaviourAction::CloseConnection`] returned by a [`NetworkBehaviour`].
/// ///
/// The test expects both behaviours to be notified via pairs of /// The test expects both behaviours to be notified via pairs of
/// inject_connected / inject_disconnected as well as /// [`NetworkBehaviour::inject_connection_established`] / [`NetworkBehaviour::inject_connection_closed`] calls.
/// inject_connection_established / inject_connection_closed calls.
#[test] #[test]
fn test_behaviour_disconnect_all() { fn test_behaviour_disconnect_all() {
// Since the test does not try to open any substreams, we can // Since the test does not try to open any substreams, we can
@ -1967,8 +1964,7 @@ mod tests {
/// using [`NetworkBehaviourAction::CloseConnection`] returned by a [`NetworkBehaviour`]. /// using [`NetworkBehaviourAction::CloseConnection`] returned by a [`NetworkBehaviour`].
/// ///
/// The test expects both behaviours to be notified via pairs of /// The test expects both behaviours to be notified via pairs of
/// inject_connected / inject_disconnected as well as /// [`NetworkBehaviour::inject_connection_established`] / [`NetworkBehaviour::inject_connection_closed`] calls.
/// inject_connection_established / inject_connection_closed calls.
#[test] #[test]
fn test_behaviour_disconnect_one() { fn test_behaviour_disconnect_one() {
// Since the test does not try to open any substreams, we can // Since the test does not try to open any substreams, we can