fn receive_packet(&mut self) -> Result<(Vec<u8>, bool), ()> {
        loop {
            if let Some(p) = self.packets.pop_front() {
                return Ok(p);
            }

            // No packets means we don't have enough data for a full one.
            // The only way to get more is reading the stream
            if let Err(e) = self.process_tcp_packet() {
                println!("failed to read packet: {:?}", e);
                return Err(());
            };
        }
    }
// Receives a packet from the TCP stream
Receives a packet from the TCP stream
Receives a packet from the TCP stream
fn receive_packet(&mut self) -> Result<(Vec<u8>, bool), ()> {
        loop {
            if let Some(p) = self.packets.pop_front() {
                return Ok(p);
            }
            // No packets means we don't have enough data for a full one.
            // The only way to get more is reading the stream
            if let Err(e) = self.process_tcp_packet() {
                println!("failed to read packet: {:?}", e);
                return Err(());
            };
        }
    }
fn receive_packet ( & mut self ) -> Result < ( Vec < u8 > , bool ) , ( ) > { loop { if let Some ( p ) = self . packets . pop_front ( ) { return Ok ( p ) ; } // No packets means we don't have enough data for a full one. // The only way to get more is reading the stream if let Err ( e ) = self . process_tcp_packet ( ) { println ! ( " " e ) ; return Err ( ( ) ) ; } ; } }
Receives a packet from the TCP stream
Receives a packet from the TCP stream
&mut self