pub struct ListenerHandle { /* private fields */ }Expand description
Handle to a running listener (SRV-001).
stop performs the graceful shutdown: the accept loop
ends, every connection finishes its in-flight requests, drains its
writer and closes; stop resolves when the last connection is gone.
Dropping the handle signals the same shutdown without waiting.
Implementations§
Source§impl ListenerHandle
impl ListenerHandle
Sourcepub fn local_addr(&self) -> SocketAddr
pub fn local_addr(&self) -> SocketAddr
The bound address (resolves port 0 binds).
Sourcepub fn snapshot(&self) -> MetricsSnapshot
pub fn snapshot(&self) -> MetricsSnapshot
Point-in-time metrics (SRV-030).
Sourcepub fn metrics(&self) -> MetricsRef
pub fn metrics(&self) -> MetricsRef
A clonable metrics reader that does not carry lifecycle.
Hand this to an exporter task instead of sharing the handle itself, so
the handle keeps single ownership and graceful stop
stays available.
Sourcepub async fn stop(&self)
pub async fn stop(&self)
Graceful shutdown (SRV-001): stop accepting, let every connection drain its in-flight responses, and resolve once all of them closed.
Takes &self so an Arc<ListenerHandle> can still drain — sharing the
handle must not cost the graceful path. Calling it twice is safe: the
second call observes the shutdown the first one completed.