[][src]Trait tsproto::connectionmanager::Resender

pub trait Resender: Sink<SinkItem = (PacketType, u32, u16, Bytes), SinkError = Error> {
    fn ack_packet(&mut self, p_type: PacketType, p_id: u16);
fn send_voice_packets(&self, p_type: PacketType) -> bool;
fn is_empty(&self) -> bool;
fn handle_event(&mut self, event: ResenderEvent);
fn udp_packet_received(&mut self, packet: &Bytes);
fn is_disconnecting(&self) -> bool; }

For each connection, a resender is created, which is responsible for sending command packets and ensure, that they are delivered.

This is accomplished by implementing a sink, which takes the packet type, id and the packet itself. The id must be Command or CommandLow.

You should note that the resending should be implemented independant of the sink, so it is possible to put two packets into the sink while no ack has been received.

Required methods

fn ack_packet(&mut self, p_type: PacketType, p_id: u16)

Called for a received ack packet.

The packet type must be Command or CommandLow.

fn send_voice_packets(&self, p_type: PacketType) -> bool

The resender can block outgoing voice packets.

Return true to allow sending and false to block packets.

fn is_empty(&self) -> bool

If there are packets in the queue which were not acknowledged.

fn handle_event(&mut self, event: ResenderEvent)

This method informs the resender of state changes of the connection.

fn udp_packet_received(&mut self, packet: &Bytes)

Called for received udp packets.

fn is_disconnecting(&self) -> bool

Return true if the connection is trying to disconnect.

Loading content...

Implementors

impl Resender for DefaultResender[src]

Loading content...