Skip to content

Commit

Permalink
expose Behaviour::connected and Behaviour::addresses
Browse files Browse the repository at this point in the history
Signed-off-by: ozkanonur <[email protected]>
  • Loading branch information
onur-ozkan committed Jun 22, 2023
1 parent b23a4a7 commit 18ea261
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion protocols/autonat/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ pub struct Behaviour {
// Connected peers with the observed address of each connection.
// If the endpoint of a connection is relayed or not global (in case of Config::only_global_ips),
// the observed address is `None`.
connected: HashMap<PeerId, HashMap<ConnectionId, Option<Multiaddr>>>,
pub connected: HashMap<PeerId, HashMap<ConnectionId, Option<Multiaddr>>>,

// Used servers in recent outbound probes that are throttled through Config::throttle_server_period.
throttled_servers: Vec<(PeerId, Instant)>,
Expand Down
2 changes: 1 addition & 1 deletion protocols/identify/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use std::{
pub struct Behaviour {
config: Config,
/// For each peer we're connected to, the observed address to send back to it.
connected: HashMap<PeerId, HashMap<ConnectionId, Multiaddr>>,
pub connected: HashMap<PeerId, HashMap<ConnectionId, Multiaddr>>,
/// Pending events to be emitted when polled.
events: VecDeque<ToSwarm<Event, InEvent>>,
/// The addresses of all peers that we have discovered.
Expand Down
10 changes: 5 additions & 5 deletions protocols/request-response/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ where
VecDeque<ToSwarm<Event<TCodec::Request, TCodec::Response>, RequestProtocol<TCodec>>>,
/// The currently connected peers, their pending outbound and inbound responses and their known,
/// reachable addresses, if any.
connected: HashMap<PeerId, SmallVec<[Connection; 2]>>,
pub connected: HashMap<PeerId, SmallVec<[Connection; 2]>>,
/// Externally managed addresses via `add_address` and `remove_address`.
addresses: HashMap<PeerId, SmallVec<[Multiaddr; 6]>>,
pub addresses: HashMap<PeerId, SmallVec<[Multiaddr; 6]>>,
/// Requests that have not yet been sent and are waiting for a connection
/// to be established.
pending_outbound_requests: HashMap<PeerId, SmallVec<[RequestProtocol<TCodec>; 10]>>,
Expand Down Expand Up @@ -922,9 +922,9 @@ where
const EMPTY_QUEUE_SHRINK_THRESHOLD: usize = 100;

/// Internal information tracked for an established connection.
struct Connection {
id: ConnectionId,
address: Option<Multiaddr>,
pub struct Connection {
pub id: ConnectionId,
pub address: Option<Multiaddr>,
/// Pending outbound responses where corresponding inbound requests have
/// been received on this connection and emitted via `poll` but have not yet
/// been answered.
Expand Down

0 comments on commit 18ea261

Please sign in to comment.