Skip to main content

HostSession

Struct HostSession 

Source
pub struct HostSession { /* private fields */ }
Expand description

The daemon’s end of a device connection.

Implementations§

Source§

impl HostSession

Source

pub fn new(config: HostConfig, now: Instant) -> HostSession

Starts waiting for the agent’s hello; it must arrive within the peer timeout.

Source

pub fn receive(&mut self, bytes: &[u8], now: Instant)

Feeds bytes read from the connection.

Source

pub fn receive_eof(&mut self, now: Instant)

The connection reached its end.

Source

pub fn handle_timeout(&mut self, now: Instant)

Acts on deadlines and liveness that are due at now.

Source

pub fn poll_timeout(&self) -> Option<Instant>

When handle_timeout must next run; None once closed.

Source

pub fn send_request( &mut self, call: Call, deadline: Option<Duration>, now: Instant, ) -> Result<u32, Error>

Sends a request, returning its id. Fails at once, sending nothing, when the session is not ready or closed, when the agent did not advertise the capability the method needs, or when the request exceeds the negotiated frame size.

Source

pub fn resync(&mut self, stream: Stream, now: Instant) -> Result<u32, Error>

Asks the agent to resynchronize stream; the outcome arrives as HostEvent::Resynced or HostEvent::ResyncFailed.

Source

pub fn streams(&self) -> &StreamTracker

Sequence state of the event streams.

Source

pub fn poll_transmit(&mut self) -> Option<Vec<u8>>

Bytes to write to the connection.

Source

pub fn poll_event(&mut self) -> Option<HostEvent>

Source

pub fn negotiated(&self) -> Option<&Negotiated>

What the handshake settled, once it has.

Source

pub fn is_closed(&self) -> bool

Source

pub fn close_reason(&self) -> Option<&DisconnectReason>

Why the session closed, once it has.

Source

pub fn close(&mut self)

Closes the session from this side, failing every pending request.

Trait Implementations§

Source§

impl Debug for HostSession

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.