pub struct Endpoint { /* private fields */ }Expand description
A QUIC endpoint on one worker socket: accept, dial, or both.
Created by new; clones share the endpoint. Dropping the
last handle stops new accepts and dials, but connections already
established (or still handshaking) are served until they end; the socket
closes when the last one does.
Implementations§
Source§impl Endpoint
impl Endpoint
Sourcepub fn new(socket: Socket, config: Config) -> Result<Self, Error>
pub fn new(socket: Socket, config: Config) -> Result<Self, Error>
Serve socket on the worker that adopted it.
The socket names the worker: the demux task and every connection driver run there, and a socket adopted as a reuseport member steers the ids this endpoint issues to itself. Refused once that worker has been dropped, since nothing would ever drive the endpoint.
Sourcepub fn local_addr(&self) -> SocketAddr
pub fn local_addr(&self) -> SocketAddr
The socket’s bound local address.
Sourcepub async fn accept(&self) -> Result<Connection, Error>
pub async fn accept(&self) -> Result<Connection, Error>
The next handshaken incoming connection.
Fails immediately on an endpoint built without a
server configuration, and with the socket’s error
once the endpoint has died, its worker included.
Sourcepub async fn connect(&self, config: &Config) -> Result<Connection, Error>
pub async fn connect(&self, config: &Config) -> Result<Connection, Error>
Dial Config::peer through this
endpoint’s socket, driving the handshake to completion.