pub enum Listener {
Tcp(TcpListenerInfo),
Uds(UdsListenerInfo),
TlsTcp(TlsTcpListenerInfo),
}
Expand description
Wrapper around common protocol-specific listener specifiers.
Variants§
Implementations§
Source§impl Listener
impl Listener
Source§impl Listener
impl Listener
Sourcepub async fn run(
&self,
ks: KillSwitch,
acceptor: impl Acceptor + Send,
) -> Result<(), Error>
pub async fn run( &self, ks: KillSwitch, acceptor: impl Acceptor + Send, ) -> Result<(), Error>
Run a listener loop.
If the socket bind is successful the Acceptor::bound()
of acceptor
will be called, where the bound socket address will be passed as an
argument. (This can be used to retreive the port number if the
application requested the port number to be automatically assigned.
Each time a client has connected the acceptor will call
Acceptor::connected()
to allow the application to process the
connection. The ownership of the newly established connection will be
passed to the connected()
method.
§Unix domain sockets
If the listener is a unix domain socket, the socket file will be removed if the listener is aborted.
§Errors
Error::IO
can indicate the inability to bind socket.
For “forced” UDS sockets, an ErrorKind::Other
is returned if the file
already exists and is not a socket.