fn recv(&self, payload: &mut [u8]) -> (usize, Option<SocketAddr>) {
        let (size, addr) = self.transport.recv(payload);

        let (is_stun, raw_msg) = self.stun.process_stun(&payload[0..size]);
        /* This is a STUN message which has been processed already */
        if is_stun && raw_msg.is_none() {
            return (0, None);
        }

        if raw_msg.is_none() {
            let mut rtp: Vec<u8> = vec![0; size];
            rtp[0..size].clone_from_slice(&payload[0..size]);
            payload[0..size].clone_from_slice(&rtp);

            debug!("Receiving non-STUN of size {}", size);

            return (size, None)
        } else {
            self.handler.use_candidate(addr.unwrap());

            self.send(&raw_msg.unwrap());

            return (0, None)
        }

    }
// Receive the packet that comes on the other side side of the channel
// and handle it
Receive the packet that comes on the other side side of the channel
and handle it
Receive the packet that comes on the other side side of the channel and handle it
fn recv(&self, payload: &mut [u8]) -> (usize, Option<SocketAddr>) {
        let (size, addr) = self.transport.recv(payload);
        let (is_stun, raw_msg) = self.stun.process_stun(&payload[0..size]);
        /* This is a STUN message which has been processed already */
        if is_stun && raw_msg.is_none() {
            return (0, None);
        }
        if raw_msg.is_none() {
            let mut rtp: Vec<u8> = vec![0; size];
            rtp[0..size].clone_from_slice(&payload[0..size]);
            payload[0..size].clone_from_slice(&rtp);
            debug!("Receiving non-STUN of size {}", size);
            return (size, None)
        } else {
            self.handler.use_candidate(addr.unwrap());
            self.send(&raw_msg.unwrap());
            return (0, None)
        }
    }
fn recv ( & self , payload : & mut [ u8 ] ) -> ( usize , Option < SocketAddr > ) { let ( size , addr ) = self . transport . recv ( payload ) ; let ( is_stun , raw_msg ) = self . stun . process_stun ( & payload [ 0 .. size ] ) ; /* This is a STUN message which has been processed already */ if is_stun && raw_msg . is_none ( ) { return ( 0 , None ) ; } if raw_msg . is_none ( ) { let mut rtp : Vec < u8 > = vec ! [ 0 size ] ; rtp [ 0 .. size ] . clone_from_slice ( & payload [ 0 .. size ] ) ; payload [ 0 .. size ] . clone_from_slice ( & rtp ) ; debug ! ( " " size ) ; return ( size , None ) } else { self . handler . use_candidate ( addr . unwrap ( ) ) ; self . send ( & raw_msg . unwrap ( ) ) ; return ( 0 , None ) } }
Receive the packet that comes on the other side side of the channel
and handle it
Receive the packet that comes on the other side side of the channel and handle it
&self
payload
&mut [u8]
&self
payload
&mut [u8]