[][src]Trait solicit::http::session::Session

pub trait Session {
    fn new_data_chunk(
        &mut self,
        stream_id: StreamId,
        data: &[u8],
        conn: &mut HttpConnection
    ) -> HttpResult<()>;
fn new_headers<'n, 'v>(
        &mut self,
        stream_id: StreamId,
        headers: Vec<Header<'n, 'v>>,
        conn: &mut HttpConnection
    ) -> HttpResult<()>;
fn end_of_stream(
        &mut self,
        stream_id: StreamId,
        conn: &mut HttpConnection
    ) -> HttpResult<()>;
fn rst_stream(
        &mut self,
        stream_id: StreamId,
        error_code: ErrorCode,
        conn: &mut HttpConnection
    ) -> HttpResult<()>;
fn new_settings(
        &mut self,
        settings: Vec<HttpSetting>,
        conn: &mut HttpConnection
    ) -> HttpResult<()>;
fn on_ping(
        &mut self,
        ping: &PingFrame,
        conn: &mut HttpConnection
    ) -> HttpResult<()>;
fn on_pong(
        &mut self,
        ping: &PingFrame,
        conn: &mut HttpConnection
    ) -> HttpResult<()>; fn on_goaway(
        &mut self,
        _last_stream_id: StreamId,
        error_code: ErrorCode,
        debug_data: Option<&[u8]>,
        _conn: &mut HttpConnection
    ) -> HttpResult<()> { ... } }

A trait that defines the interface between an HttpConnection and the higher-levels that use it. Essentially, it allows the HttpConnection to pass information onto those higher levels through a well-defined interface.

These methods are effectively a set of callbacks that the HttpConnection invokes when the corresponding events arise on the HTTP/2 connection (i.e. frame stream).

Required methods

fn new_data_chunk(
    &mut self,
    stream_id: StreamId,
    data: &[u8],
    conn: &mut HttpConnection
) -> HttpResult<()>

Notifies the Session that a new data chunk has arrived on the connection for a particular stream. Only the raw data is passed to the callback (all padding is already discarded by the connection).

fn new_headers<'n, 'v>(
    &mut self,
    stream_id: StreamId,
    headers: Vec<Header<'n, 'v>>,
    conn: &mut HttpConnection
) -> HttpResult<()>

Notifies the Session that headers have arrived for a particular stream. The given list of headers is already decoded by the connection. TODO: The Session should be notified separately for every header that is decoded.

fn end_of_stream(
    &mut self,
    stream_id: StreamId,
    conn: &mut HttpConnection
) -> HttpResult<()>

Notifies the Session that a particular stream got closed by the peer.

fn rst_stream(
    &mut self,
    stream_id: StreamId,
    error_code: ErrorCode,
    conn: &mut HttpConnection
) -> HttpResult<()>

Notifies the Session that a particular stream was reset by the peer and provides the reason behind it.

fn new_settings(
    &mut self,
    settings: Vec<HttpSetting>,
    conn: &mut HttpConnection
) -> HttpResult<()>

Notifies the Session that the peer has sent a new set of settings. The session itself is responsible for acknowledging the receipt of the settings.

fn on_ping(
    &mut self,
    ping: &PingFrame,
    conn: &mut HttpConnection
) -> HttpResult<()>

Notifies the Session that a PING request has been received. The session itself is responsible for replying with an ACK.

fn on_pong(
    &mut self,
    ping: &PingFrame,
    conn: &mut HttpConnection
) -> HttpResult<()>

Notifies the Session that a PING acknowledgement has been received.

Loading content...

Provided methods

fn on_goaway(
    &mut self,
    _last_stream_id: StreamId,
    error_code: ErrorCode,
    debug_data: Option<&[u8]>,
    _conn: &mut HttpConnection
) -> HttpResult<()>

Notifies the Session that the peer has sent a GOAWAY frame, indicating that the connection is terminated.

The default implementation simply maps the error into an appropriate HttpError::PeerConnectionError struct.

Concrete Session implementations can override this in order to, for example, figure out which streams can be safely retried (based on the last processed stream id).

Loading content...

Implementors

impl<'a, State, F, S> Session for ServerSession<'a, State, F, S> where
    State: SessionState + 'a,
    S: SendFrame + 'a,
    F: StreamFactory<Stream = State::Stream> + 'a, 
[src]

impl<'a, State, S> Session for ClientSession<'a, State, S> where
    State: SessionState + 'a,
    S: SendFrame + 'a, 
[src]

Loading content...