From e943967afbf31568e3eb61db6094f0b03f8a2133 Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Thu, 29 Jun 2023 10:12:31 +0200 Subject: [PATCH 1/4] add std::any::type_name logs for OrTransport when trying addresses --- core/src/transport/choice.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/src/transport/choice.rs b/core/src/transport/choice.rs index b7eaacabfeb..c30f98674d5 100644 --- a/core/src/transport/choice.rs +++ b/core/src/transport/choice.rs @@ -51,13 +51,21 @@ where id: ListenerId, addr: Multiaddr, ) -> Result<(), TransportError> { + println!("Trying address on {}...", std::any::type_name::()); let addr = match self.0.listen_on(id, addr) { - Err(TransportError::MultiaddrNotSupported(addr)) => addr, + Err(TransportError::MultiaddrNotSupported(addr)) => { + println!("Failed on {}", std::any::type_name::()); + addr + } res => return res.map_err(|err| err.map(Either::Left)), }; + println!("Trying address on {}...", std::any::type_name::()); let addr = match self.1.listen_on(id, addr) { - Err(TransportError::MultiaddrNotSupported(addr)) => addr, + Err(TransportError::MultiaddrNotSupported(addr)) => { + println!("Failed on {}", std::any::type_name::()); + addr + } res => return res.map_err(|err| err.map(Either::Right)), }; From a9c27b2df3960188b482cdd4e87353b58e12902f Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Thu, 29 Jun 2023 11:44:01 +0200 Subject: [PATCH 2/4] improving logs --- core/src/transport/choice.rs | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/core/src/transport/choice.rs b/core/src/transport/choice.rs index c30f98674d5..28afe71edb7 100644 --- a/core/src/transport/choice.rs +++ b/core/src/transport/choice.rs @@ -22,6 +22,7 @@ use crate::either::EitherFuture; use crate::transport::{ListenerId, Transport, TransportError, TransportEvent}; use either::Either; use futures::future; +use log::{debug, trace}; use multiaddr::Multiaddr; use std::{pin::Pin, task::Context, task::Poll}; @@ -51,19 +52,35 @@ where id: ListenerId, addr: Multiaddr, ) -> Result<(), TransportError> { - println!("Trying address on {}...", std::any::type_name::()); + trace!( + "Attempting to dial {} using {}", + addr, + std::any::type_name::() + ); let addr = match self.0.listen_on(id, addr) { Err(TransportError::MultiaddrNotSupported(addr)) => { - println!("Failed on {}", std::any::type_name::()); + debug!( + "Failing to dial {} using {}", + addr, + std::any::type_name::() + ); addr } res => return res.map_err(|err| err.map(Either::Left)), }; - println!("Trying address on {}...", std::any::type_name::()); + trace!( + "Attempting to dial {} using {}", + addr, + std::any::type_name::() + ); let addr = match self.1.listen_on(id, addr) { Err(TransportError::MultiaddrNotSupported(addr)) => { - println!("Failed on {}", std::any::type_name::()); + debug!( + "Failing to dial {} using {}", + addr, + std::any::type_name::() + ); addr } res => return res.map_err(|err| err.map(Either::Right)), From 1e5268f3a6ca39245f9f9f7ed5f9d1625faf18c2 Mon Sep 17 00:00:00 2001 From: Thomas Coratger <60488569+tcoratger@users.noreply.github.com> Date: Fri, 30 Jun 2023 20:39:14 +0200 Subject: [PATCH 3/4] Update core/src/transport/choice.rs Co-authored-by: Max Inden --- core/src/transport/choice.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/transport/choice.rs b/core/src/transport/choice.rs index 28afe71edb7..d47e9c17d8e 100644 --- a/core/src/transport/choice.rs +++ b/core/src/transport/choice.rs @@ -60,7 +60,7 @@ where let addr = match self.0.listen_on(id, addr) { Err(TransportError::MultiaddrNotSupported(addr)) => { debug!( - "Failing to dial {} using {}", + "Failed to dial {} using {}", addr, std::any::type_name::() ); From fb06f437f0505f91c0b3b27a04815c343b5b4694 Mon Sep 17 00:00:00 2001 From: Thomas Coratger <60488569+tcoratger@users.noreply.github.com> Date: Fri, 30 Jun 2023 20:39:21 +0200 Subject: [PATCH 4/4] Update core/src/transport/choice.rs Co-authored-by: Max Inden --- core/src/transport/choice.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/transport/choice.rs b/core/src/transport/choice.rs index d47e9c17d8e..d97de03d7f7 100644 --- a/core/src/transport/choice.rs +++ b/core/src/transport/choice.rs @@ -77,7 +77,7 @@ where let addr = match self.1.listen_on(id, addr) { Err(TransportError::MultiaddrNotSupported(addr)) => { debug!( - "Failing to dial {} using {}", + "Failed to dial {} using {}", addr, std::any::type_name::() );