pub async fn send_packet(&self, pkt: &[u8]) -> io::Result<()> {
        if !self.assoc_manager.keep_alive(&self.cache_key).await {
            debug!(
                "UDP association {} <-> ... is already expired, throwing away packet {} bytes",
                self.src_addr,
                pkt.len()
            );
            return Ok(());
        }

        let n = match self.tx.send_to(&pkt, &self.src_addr).await {
            Ok(n) => {
                if n < pkt.len() {
                    warn!(
                        "UDP association {} <- ... payload truncated, expecting {} bytes, but sent {} bytes",
                        self.src_addr,
                        pkt.len(),
                        n
                    );
                }
                n
            }
            Err(err) => return Err(err),
        };

        self.flow_stat.udp().incr_tx(n);

        Ok(())
    }
/// Send packet back to source client
Send packet back to source client
Send packet back to source client
pub async fn send_packet(&self, pkt: &[u8]) -> io::Result<()> {
        if !self.assoc_manager.keep_alive(&self.cache_key).await {
            debug!(
                "UDP association {} <-> ... is already expired, throwing away packet {} bytes",
                self.src_addr,
                pkt.len()
            );
            return Ok(());
        }
        let n = match self.tx.send_to(&pkt, &self.src_addr).await {
            Ok(n) => {
                if n < pkt.len() {
                    warn!(
                        "UDP association {} <- ... payload truncated, expecting {} bytes, but sent {} bytes",
                        self.src_addr,
                        pkt.len(),
                        n
                    );
                }
                n
            }
            Err(err) => return Err(err),
        };
        self.flow_stat.udp().incr_tx(n);
        Ok(())
    }
pub async fn send_packet ( & self , pkt : & [ u8 ] ) -> io :: Result < ( ) > { if ! self . assoc_manager . keep_alive ( & self . cache_key ) . await { debug ! ( " " self src_addr pkt len ( ) ) ; return Ok ( ( ) ) ; } let n = match self . tx . send_to ( & pkt , & self . src_addr ) . await { Ok ( n ) => { if n < pkt . len ( ) { warn ! ( " " self src_addr pkt len ( ) n ) ; } n } Err ( err ) => return Err ( err ) , } ; self . flow_stat . udp ( ) . incr_tx ( n ) ; Ok ( ( ) ) }
Send packet back to source client
Send packet back to source client
&self
pkt
&[u8]