pub struct Session<S> { /* private fields */ }Expand description
An established binary session. Construction completes both offers and both acceptance bytes before application operations may be sent or received.
Implementations§
Source§impl<S: Read + Write> Session<S>
impl<S: Read + Write> Session<S>
Sourcepub fn connect(io: S, offer: &Hello) -> Result<Self>
pub fn connect(io: S, offer: &Hello) -> Result<Self>
Connect on an explicitly advertised v2 endpoint. The caller sets a single establishment deadline and verifies the peer before sending the offer.
Sourcepub fn accept(io: S, offer: &Hello) -> Result<Self>
pub fn accept(io: S, offer: &Hello) -> Result<Self>
Admit a connection on the separate v2 listener, after authenticating its OS peer. No request is dispatched if either peer rejects the negotiation.
Sourcepub fn refuse(io: S, offer: &Hello, reason: Refused) -> Result<()>
pub fn refuse(io: S, offer: &Hello, reason: Refused) -> Result<()>
Read a client’s offer and refuse it for reason, then close the
connection. Use it for a peer the policy rejected, or while retiring.
A client that does not read refusals, or that names another service,
sees only the close, as from an older server.
Sourcepub fn transport_mut(&mut self) -> &mut S
pub fn transport_mut(&mut self) -> &mut S
Access the transport to change I/O deadlines after establishment. Do not read or write protocol bytes through this reference.