mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-12 01:21:21 +00:00
feat(swarm): expose ConnectionId
and add conn duration metric
- Exposes the `ConnectionId` in the various `SwarmEvent` variants. - Tracks connection duration in `libp2p-metrics::swarm`. Pull-Request: #3927.
This commit is contained in:
@ -86,7 +86,7 @@ async fn main() -> Result<()> {
|
||||
let server_peer_id = loop {
|
||||
match swarm.next().await.unwrap() {
|
||||
SwarmEvent::ConnectionEstablished { peer_id, .. } => break peer_id,
|
||||
SwarmEvent::OutgoingConnectionError { peer_id, error } => {
|
||||
SwarmEvent::OutgoingConnectionError { peer_id, error, .. } => {
|
||||
bail!("Outgoing connection error to {:?}: {:?}", peer_id, error);
|
||||
}
|
||||
e => panic!("{e:?}"),
|
||||
@ -113,7 +113,7 @@ async fn main() -> Result<()> {
|
||||
} => {
|
||||
info!("Established connection to {:?} via {:?}", peer_id, endpoint);
|
||||
}
|
||||
SwarmEvent::OutgoingConnectionError { peer_id, error } => {
|
||||
SwarmEvent::OutgoingConnectionError { peer_id, error, .. } => {
|
||||
info!("Outgoing connection error to {:?}: {:?}", peer_id, error);
|
||||
}
|
||||
SwarmEvent::Behaviour(libp2p_perf::client::Event { id: _, result }) => break result?,
|
||||
|
Reference in New Issue
Block a user