Skip to main content

explain_bind_failure

Function explain_bind_failure 

Source
pub fn explain_bind_failure(what: &str, addr: &str, error: &Error) -> String
Expand description

Report a failure to take a listening socket, in the words this program uses everywhere else.

Without this the gateway and the relay both ended a failed startup with the Debug form of an io::ErrorError: Io(Os { code: 10048, kind: AddrInUse, ... }) — which is the one place in the binary a Rust internal leaks out. Shared because both do it: fixing one leaves the identical screen on the other, confirmed by running both against a taken port.

AddrInUse gets the case worth naming, because “the port is taken” is by far the most common way this fails and has an obvious next step. Classified from std::io::ErrorKind rather than from the message, which the OS writes in its own language.