pub trait ConnectionHandlerwhere
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§
Sourcetype InitialData: Clone
type InitialData: Clone
initial data provided to new
Sourcetype ConstructError
type ConstructError
error type raised from new
Required Methods§
Sourcefn new(
init_data: Self::InitialData,
connection: &mut Connection<Self>,
) -> Result<Self, Self::ConstructError>
fn new( init_data: Self::InitialData, connection: &mut Connection<Self>, ) -> Result<Self, Self::ConstructError>
construct handler object
Provided Methods§
Sourcefn handshake_done(&mut self, _connection: &mut Connection<Self>)
fn handshake_done(&mut self, _connection: &mut Connection<Self>)
called on handshake finish (or incomplete handshake)
Sourcefn data_received(
&mut self,
_connection: &mut Connection<Self>,
_direction: Direction,
)
fn data_received( &mut self, _connection: &mut Connection<Self>, _direction: Direction, )
called on data received
Sourcefn ack_received(
&mut self,
_connection: &mut Connection<Self>,
_direction: Direction,
)
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
Sourcefn fin_received(
&mut self,
_connection: &mut Connection<Self>,
_direction: Direction,
)
fn fin_received( &mut self, _connection: &mut Connection<Self>, _direction: Direction, )
called on FIN
Sourcefn rst_received(
&mut self,
_connection: &mut Connection<Self>,
_direction: Direction,
_extra: PacketExtra,
)
fn rst_received( &mut self, _connection: &mut Connection<Self>, _direction: Direction, _extra: PacketExtra, )
called on RST
Sourcefn stream_end(
&mut self,
_connection: &mut Connection<Self>,
_direction: Direction,
)
fn stream_end( &mut self, _connection: &mut Connection<Self>, _direction: Direction, )
ACK for FIN received for stream
Sourcefn connection_desync(
&mut self,
_connection: &mut Connection<Self>,
_direction: Direction,
)
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
Sourcefn will_retire(&mut self, _connection: &mut Connection<Self>)
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", so this trait is not object safe.