fn drain_packets(
        h: &mut TcpIPv4Handler,
        src_addr: Ipv4Addr,
        remote_addr: Ipv4Addr,
    ) -> Result<usize, WriteNextError> {
        let mut buf = [0u8; 2000];
        let mut count: usize = 0;
        loop {
            let (o, _) = write_next(h, buf.as_mut())?;
            if let Some(packet) = o {
                count += 1;
                assert_eq!(packet.source_address(), src_addr);
                assert_eq!(packet.destination_address(), remote_addr);
            } else {
                break;
            }
        }
        Ok(count)
    }
// Calls write_next_packet until either an error occurs, or there's nothing left to send.
// When successful, returns how many packets were written. The remote_addr argument is used
// to check the packets are sent to the appropriate destination.
Calls write_next_packet until either an error occurs, or there's nothing left to send.
When successful, returns how many packets were written. The remote_addr argument is used
to check the packets are sent to the appropriate destination.
Calls write_next_packet until either an error occurs or there ' s nothing left to send . When successful returns how many packets were written . The remote_addr argument is used to check the packets are sent to the appropriate destination .
fn drain_packets(
        h: &mut TcpIPv4Handler,
        src_addr: Ipv4Addr,
        remote_addr: Ipv4Addr,
    ) -> Result<usize, WriteNextError> {
        let mut buf = [0u8; 2000];
        let mut count: usize = 0;
        loop {
            let (o, _) = write_next(h, buf.as_mut())?;
            if let Some(packet) = o {
                count += 1;
                assert_eq!(packet.source_address(), src_addr);
                assert_eq!(packet.destination_address(), remote_addr);
            } else {
                break;
            }
        }
        Ok(count)
    }
fn drain_packets ( h : & mut TcpIPv4Handler , src_addr : Ipv4Addr , remote_addr : Ipv4Addr , ) -> Result < usize , WriteNextError > { let mut buf = [ 0u8 ; 2000 ] ; let mut count : usize = 0 ; loop { let ( o , _ ) = write_next ( h , buf . as_mut ( ) ) ? ; if let Some ( packet ) = o { count += 1 ; assert_eq ! ( packet source_address ( ) src_addr ) ; assert_eq ! ( packet destination_address ( ) remote_addr ) ; } else { break ; } } Ok ( count ) }
Calls write_next_packet until either an error occurs, or there's nothing left to send.
Calls write_next_packet until either an error occurs or there ' s nothing left to send .
h
&mut TcpIPv4Handler
src_addr
Ipv4Addr
remote_addr
Ipv4Addr
h
&mut TcpIPv4Handler
src_addr
Ipv4Addr
remote_addr
Ipv4Addr