pub struct Listener { /* private fields */ }Expand description
Listens for incoming plain-TCP qmux connections on a TCP port.
Implementations§
Source§impl Listener
impl Listener
Sourcepub async fn bind(addr: SocketAddr) -> Result<Self, Error>
pub async fn bind(addr: SocketAddr) -> Result<Self, Error>
Bind a TCP listener to the given address.
Sourcepub fn accept_health(&self) -> Health
pub fn accept_health(&self) -> Health
A live handle to this listener’s accept-loop health, for an embedder that
publishes it (see crate::accept).
Sourcepub fn with_accept_health(self, health: Health) -> Self
pub fn with_accept_health(self, health: Health) -> Self
Report into health instead of the one this listener made for itself.
For an owner that has to hand the handle out before the listener exists:
crate::Server binds these lazily (they need a runtime), but an embedder
registering them with a metrics endpoint does so at startup.
Sourcepub fn with_protocols<I, S>(self, protocols: I) -> Self
pub fn with_protocols<I, S>(self, protocols: I) -> Self
Advertise these application protocols (moq ALPNs) for in-band negotiation, in preference order. The first server entry the client also offers wins.
Sourcepub fn local_addr(&self) -> Result<SocketAddr, Error>
pub fn local_addr(&self) -> Result<SocketAddr, Error>
The local address the listener is bound to.
Sourcepub async fn accept(&self) -> Option<Result<Session, Error>>
pub async fn accept(&self) -> Option<Result<Session, Error>>
Accept the next connection, performing the qmux handshake over plain TCP.
A failed accept(2) is handled here rather than yielded: it is classified,
counted, logged, and paced by accept_health, then
retried, because the caller has no better answer than to ask again. A
per-connection handshake failure is still yielded as Some(Err(..)).
The Option no longer has a None case to report: nothing ends the accept
loop, so this always yields. It stays because dropping it is a breaking change
to a published signature.