pub fn tick<F: FnMut(Message) -> bool>(&mut self, mut send_message: F) {
        let max_sequence = self.earliest_unacked_sequence + RELIABLE_BUFFER_SIZE as u32;
        for packet in self.reliable_packets.iter_mut() {
            // Don't send a packet the receiver can't buffer
            if packet.sequence >= max_sequence {
                break
            }
            // Resend packet if enough time has elapsed
            let now = Instant::now();
            if now - packet.last_send > RESEND_DELAY {
                if send_message(Message::Reliable {
                    sequence: packet.sequence,
                    data: packet.data.clone(),
                }) {
                    packet.last_send = now;
                    if packet.first_send.is_none() {
                        packet.first_send = Some(now);
                    }
                } else {
                    // Break if bandwidth is exceeded
                    break
                }
            }
        }
    }
// True if sent, false if bandwidth is exceeded
True if sent, false if bandwidth is exceeded
True if sent false if bandwidth is exceeded
pub fn tick<F: FnMut(Message) -> bool>(&mut self, mut send_message: F) {
        let max_sequence = self.earliest_unacked_sequence + RELIABLE_BUFFER_SIZE as u32;
        for packet in self.reliable_packets.iter_mut() {
            // Don't send a packet the receiver can't buffer
            if packet.sequence >= max_sequence {
                break
            }
            // Resend packet if enough time has elapsed
            let now = Instant::now();
            if now - packet.last_send > RESEND_DELAY {
                if send_message(Message::Reliable {
                    sequence: packet.sequence,
                    data: packet.data.clone(),
                }) {
                    packet.last_send = now;
                    if packet.first_send.is_none() {
                        packet.first_send = Some(now);
                    }
                } else {
                    // Break if bandwidth is exceeded
                    break
                }
            }
        }
    }
pub fn tick < F : FnMut ( Message ) -> bool > ( & mut self , mut send_message : F ) { let max_sequence = self . earliest_unacked_sequence + RELIABLE_BUFFER_SIZE as u32 ; for packet in self . reliable_packets . iter_mut ( ) { // Don't send a packet the receiver can't buffer if packet . sequence >= max_sequence { break } // Resend packet if enough time has elapsed let now = Instant :: now ( ) ; if now - packet . last_send > RESEND_DELAY { if send_message ( Message :: Reliable { sequence : packet . sequence , data : packet . data . clone ( ) , } ) { packet . last_send = now ; if packet . first_send . is_none ( ) { packet . first_send = Some ( now ) ; } } else { // Break if bandwidth is exceeded break } } } }
True if sent, false if bandwidth is exceeded
True if sent false if bandwidth is exceeded
&mut self
send_message
F
&mut self
send_message
F