pub fn new(socket: Arc<UdpSocket>, target_addr: SocketAddr) -> UdpOutput {
        let (delay_tx, mut delay_rx) = mpsc::unbounded_channel::<Vec<u8>>();

        {
            let socket = socket.clone();
            tokio::spawn(async move {
                while let Some(buf) = delay_rx.recv().await {
                    if let Err(err) = socket.send_to(&buf, target_addr).await {
                        error!("[SEND] UDP delayed send failed, error: {}", err);
                    }
                }
            });
        }

        UdpOutput {
            socket,
            target_addr,
            delay_tx,
        }
    }
/// Create a new Writer for writing packets to UdpSocket
Create a new Writer for writing packets to UdpSocket
Create a new Writer for writing packets to UdpSocket
pub fn new(socket: Arc<UdpSocket>, target_addr: SocketAddr) -> UdpOutput {
        let (delay_tx, mut delay_rx) = mpsc::unbounded_channel::<Vec<u8>>();
        {
            let socket = socket.clone();
            tokio::spawn(async move {
                while let Some(buf) = delay_rx.recv().await {
                    if let Err(err) = socket.send_to(&buf, target_addr).await {
                        error!("[SEND] UDP delayed send failed, error: {}", err);
                    }
                }
            });
        }
        UdpOutput {
            socket,
            target_addr,
            delay_tx,
        }
    }
pub fn new ( socket : Arc < UdpSocket > , target_addr : SocketAddr ) -> UdpOutput { let ( delay_tx , mut delay_rx ) = mpsc :: unbounded_channel :: < Vec < u8 > > ( ) ; { let socket = socket . clone ( ) ; tokio :: spawn ( async move { while let Some ( buf ) = delay_rx . recv ( ) . await { if let Err ( err ) = socket . send_to ( & buf , target_addr ) . await { error ! ( " " err ) ; } } } ) ; } UdpOutput { socket , target_addr , delay_tx , } }
Create a new Writer for writing packets to UdpSocket
Create a new Writer for writing packets to UdpSocket
socket
Arc<UdpSocket>
target_addr
SocketAddr
socket
Arc<UdpSocket>
target_addr
SocketAddr