pub struct SessionHandle { /* private fields */ }Expand description
Cloneable handle for opening and closing virtual connections.
Returned by the session builder alongside the Session and root
ConnectionHandle. The session’s run() loop must be running
concurrently for requests to be processed.
Implementations§
Source§impl SessionHandle
impl SessionHandle
Sourcepub async fn open_connection(
&self,
settings: ConnectionSettings,
metadata: Metadata<'static>,
) -> Result<ConnectionHandle, SessionError>
pub async fn open_connection( &self, settings: ConnectionSettings, metadata: Metadata<'static>, ) -> Result<ConnectionHandle, SessionError>
Open a new virtual connection on the session.
Allocates a connection ID, sends ConnectionOpen to the peer, and
waits for ConnectionAccept or ConnectionReject. The session’s
run() loop processes the response and completes the returned future.
Sourcepub async fn close_connection(
&self,
conn_id: ConnectionId,
metadata: Metadata<'static>,
) -> Result<(), SessionError>
pub async fn close_connection( &self, conn_id: ConnectionId, metadata: Metadata<'static>, ) -> Result<(), SessionError>
Close a virtual connection.
Sends ConnectionClose to the peer and removes the connection slot.
After this returns, no further messages will be routed to the
connection’s driver.
pub async fn resume<I: IntoConduit>( &self, into_conduit: I, handshake_result: HandshakeResult, ) -> Result<(), SessionError>
Sourcepub fn resume_key(&self) -> Option<&SessionResumeKey>
pub fn resume_key(&self) -> Option<&SessionResumeKey>
Returns the session resume key, if the session is resumable.
Sourcepub fn shutdown(&self) -> Result<(), SessionError>
pub fn shutdown(&self) -> Result<(), SessionError>
Request shutdown of the entire session (root + all virtual connections).
Trait Implementations§
Source§impl Clone for SessionHandle
impl Clone for SessionHandle
Source§fn clone(&self) -> SessionHandle
fn clone(&self) -> SessionHandle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more