Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: add useful logs to OrTransport when trying addresses #4072

Closed
thomaseizinger opened this issue Jun 14, 2023 · 0 comments · Fixed by #4133
Closed

core: add useful logs to OrTransport when trying addresses #4072

thomaseizinger opened this issue Jun 14, 2023 · 0 comments · Fixed by #4133

Comments

@thomaseizinger
Copy link
Contributor

Description

Currently, there are no logs when OrTransport tries an address on several transports:

fn listen_on(
&mut self,
id: ListenerId,
addr: Multiaddr,
) -> Result<(), TransportError<Self::Error>> {
let addr = match self.0.listen_on(id, addr) {
Err(TransportError::MultiaddrNotSupported(addr)) => addr,
res => return res.map_err(|err| err.map(Either::Left)),
};
let addr = match self.1.listen_on(id, addr) {
Err(TransportError::MultiaddrNotSupported(addr)) => addr,
res => return res.map_err(|err| err.map(Either::Right)),
};
Err(TransportError::MultiaddrNotSupported(addr))
}
fn remove_listener(&mut self, id: ListenerId) -> bool {
self.0.remove_listener(id) || self.1.remove_listener(id)
}
fn dial(&mut self, addr: Multiaddr) -> Result<Self::Dial, TransportError<Self::Error>> {
let addr = match self.0.dial(addr) {
Ok(connec) => return Ok(EitherFuture::First(connec)),
Err(TransportError::MultiaddrNotSupported(addr)) => addr,
Err(TransportError::Other(err)) => {
return Err(TransportError::Other(Either::Left(err)))
}
};
let addr = match self.1.dial(addr) {
Ok(connec) => return Ok(EitherFuture::Second(connec)),
Err(TransportError::MultiaddrNotSupported(addr)) => addr,
Err(TransportError::Other(err)) => {
return Err(TransportError::Other(Either::Right(err)))
}
};
Err(TransportError::MultiaddrNotSupported(addr))
}

We should change that to make these cases easier to debug.

Open questions

Are you planning to do it yourself in a pull request?

No.

@mergify mergify bot closed this as completed in #4133 Jul 5, 2023
mergify bot pushed a commit that referenced this issue Jul 5, 2023
Currently, when trying addresses in `listen_on` via `OrTransport`, there are no logs to facilitate debugging. This PR corrects that by providing adequate logs via `std::any::type_name` method.

Resolves #4072.

Pull-Request: #4133.
thomaseizinger pushed a commit that referenced this issue Aug 20, 2023
Currently, when trying addresses in `listen_on` via `OrTransport`, there are no logs to facilitate debugging. This PR corrects that by providing adequate logs via `std::any::type_name` method.

Resolves #4072.

Pull-Request: #4133.
mergify bot pushed a commit that referenced this issue May 26, 2024
When you enable Kademlia in a large network that uses multiple type of transports, then this log creates a very noisy console and makes meaningful logs hard to see.

We can also remove the log entirely if you prefer. Check: #4015 (comment), #4072, #4133

Pull-Request: #5396.
TimTinkers pushed a commit to unattended-backpack/rust-libp2p that referenced this issue Sep 14, 2024
When you enable Kademlia in a large network that uses multiple type of transports, then this log creates a very noisy console and makes meaningful logs hard to see.

We can also remove the log entirely if you prefer. Check: libp2p#4015 (comment), libp2p#4072, libp2p#4133

Pull-Request: libp2p#5396.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant