pub struct Sender<T: SnapTunToken> { /* private fields */ }Expand description
Sender can be used to send packets to the client. It is returned by Server::accept_with_timeout.
Sender offers a synchronous and an asychronous API to send packets to the client.
Implementations§
Source§impl<T: SnapTunToken> Sender<T>
impl<T: SnapTunToken> Sender<T>
Sourcepub fn assigned_addresses(&self) -> Vec<EndhostAddr>
pub fn assigned_addresses(&self) -> Vec<EndhostAddr>
Returns the addresses assigned to this sender.
Sourcepub fn remote_underlay_address(&self) -> SocketAddr
pub fn remote_underlay_address(&self) -> SocketAddr
Returns the remote address of the underling QUIC connection.
Sourcepub fn send(&self, pkt: Bytes) -> Result<(), SendPacketError<T>>
pub fn send(&self, pkt: Bytes) -> Result<(), SendPacketError<T>>
Send a packet to the client. The packet needs to fit entirely into a QUIC datagram.
§Errors
The function returns an error if either the connection is in an erroneous state (non-recoverable), or the address assignment has changed. In the latter case, SendPacketError::NewAssignedAddress is returned with a new Sender object that is assigned the new address. The old object will return a SendPacketError::ConnectionClosed error.
Sourcepub async fn send_wait(&self, pkt: Bytes) -> Result<(), SendPacketError<T>>
pub async fn send_wait(&self, pkt: Bytes) -> Result<(), SendPacketError<T>>
Send a packet to the client. The packet needs to fit entirely into a QUIC datagram.
Unlike Self::send, this method will wait for buffer space during congestion conditions, which effectively prioritizes old datagrams over new datagrams.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Sender<T>
impl<T> !RefUnwindSafe for Sender<T>
impl<T> Send for Sender<T>
impl<T> Sync for Sender<T>
impl<T> Unpin for Sender<T>
impl<T> !UnwindSafe for Sender<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request