Skip to main content

bind

Function bind 

Source
pub fn bind(at: &Path) -> Result<Listener>
Expand description

Become the instance.

A refused connection means the socket is debris, not a rival. A crashed instance leaves the file behind and nothing listening on it, so binding fails with address in use forever until somebody removes it. Removing it is only safe after a connection has been refused, which is what says nobody is on the other end — deleting an endpoint somebody is serving would take the running instance’s front door away and leave two processes holding sessions.

§Errors

Where the endpoint cannot be bound, including where another instance bound it first. A caller that loses that race connects instead.