Skip to main content

ConnectionHandler

Trait ConnectionHandler 

Source
pub trait ConnectionHandler
where Self: Sized,
{ type InitialData: Clone; type ConstructError; // Required method fn new( init_data: Self::InitialData, connection: &mut Connection<Self>, ) -> Result<Self, Self::ConstructError>; // Provided methods fn handshake_done(&mut self, _connection: &mut Connection<Self>) { ... } fn data_received( &mut self, _connection: &mut Connection<Self>, _direction: Direction, ) { ... } fn ack_received( &mut self, _connection: &mut Connection<Self>, _direction: Direction, ) { ... } fn fin_received( &mut self, _connection: &mut Connection<Self>, _direction: Direction, ) { ... } fn rst_received( &mut self, _connection: &mut Connection<Self>, _direction: Direction, _extra: PacketExtra, ) { ... } fn stream_end( &mut self, _connection: &mut Connection<Self>, _direction: Direction, ) { ... } fn connection_desync( &mut self, _connection: &mut Connection<Self>, _direction: Direction, ) { ... } fn will_retire(&mut self, _connection: &mut Connection<Self>) { ... } }
Expand description

event handler for connection object

Required Associated Types§

Source

type InitialData: Clone

initial data provided to new

Source

type ConstructError

error type raised from new

Required Methods§

Source

fn new( init_data: Self::InitialData, connection: &mut Connection<Self>, ) -> Result<Self, Self::ConstructError>

construct handler object

Provided Methods§

Source

fn handshake_done(&mut self, _connection: &mut Connection<Self>)

called on handshake finish (or incomplete handshake)

Source

fn data_received( &mut self, _connection: &mut Connection<Self>, _direction: Direction, )

called on data received

Source

fn ack_received( &mut self, _connection: &mut Connection<Self>, _direction: Direction, )

called when data is acked, direction is of the ack packet, not the stream

Source

fn fin_received( &mut self, _connection: &mut Connection<Self>, _direction: Direction, )

called on FIN

Source

fn rst_received( &mut self, _connection: &mut Connection<Self>, _direction: Direction, _extra: PacketExtra, )

called on RST

Source

fn stream_end( &mut self, _connection: &mut Connection<Self>, _direction: Direction, )

ACK for FIN received for stream

Source

fn connection_desync( &mut self, _connection: &mut Connection<Self>, _direction: Direction, )

connection fatally desynchronized, direction is our best guess for the direction of the packet which caused the desync

Source

fn will_retire(&mut self, _connection: &mut Connection<Self>)

called when the connection is removed from the hashtable

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§