fn clean_old_records(&mut self) {
        let record_ptr = &self.record_buffer[0];
        let curr_size = size_of_val(record_ptr) * self.record_buffer.len();
        trace!(
            "socket rebord buffer current size: {} max_bytes: {}",
            curr_size,
            self.buffer_max_kbytes * 1000
        );
        if curr_size > (self.buffer_max_kbytes * 1000) as usize {
            let size_diff = curr_size - (self.buffer_max_kbytes * 1000) as usize;
            trace!(
                "socket record size_diff: {} sizeof: {}",
                size_diff,
                size_of_val(record_ptr)
            );
            if size_diff > size_of_val(record_ptr) {
                let nb_records_to_delete = size_diff as f32 / size_of_val(record_ptr) as f32;
                for _ in 1..nb_records_to_delete as u32 {
                    if !self.record_buffer.is_empty() {
                        let res = self.record_buffer.remove(0);
                        debug!(
                            "Cleaning socket id {} records buffer, removing: {}",
                            self.id, res
                        );
                    }
                }
            }
        }
    }
/// Checks the size in memory of record_buffer and deletes as many Record
/// instances from the buffer to make it smaller in memory than buffer_max_kbytes.
Checks the size in memory of record_buffer and deletes as many Record
instances from the buffer to make it smaller in memory than buffer_max_kbytes.
Checks the size in memory of record_buffer and deletes as many Record instances from the buffer to make it smaller in memory than buffer_max_kbytes .
fn clean_old_records(&mut self) {
        let record_ptr = &self.record_buffer[0];
        let curr_size = size_of_val(record_ptr) * self.record_buffer.len();
        trace!(
            "socket rebord buffer current size: {} max_bytes: {}",
            curr_size,
            self.buffer_max_kbytes * 1000
        );
        if curr_size > (self.buffer_max_kbytes * 1000) as usize {
            let size_diff = curr_size - (self.buffer_max_kbytes * 1000) as usize;
            trace!(
                "socket record size_diff: {} sizeof: {}",
                size_diff,
                size_of_val(record_ptr)
            );
            if size_diff > size_of_val(record_ptr) {
                let nb_records_to_delete = size_diff as f32 / size_of_val(record_ptr) as f32;
                for _ in 1..nb_records_to_delete as u32 {
                    if !self.record_buffer.is_empty() {
                        let res = self.record_buffer.remove(0);
                        debug!(
                            "Cleaning socket id {} records buffer, removing: {}",
                            self.id, res
                        );
                    }
                }
            }
        }
    }
fn clean_old_records ( & mut self ) { let record_ptr = & self . record_buffer [ 0 ] ; let curr_size = size_of_val ( record_ptr ) * self . record_buffer . len ( ) ; trace ! ( " " curr_size self buffer_max_kbytes 1000 ) ; if curr_size > ( self . buffer_max_kbytes * 1000 ) as usize { let size_diff = curr_size - ( self . buffer_max_kbytes * 1000 ) as usize ; trace ! ( " " size_diff size_of_val ( record_ptr ) ) ; if size_diff > size_of_val ( record_ptr ) { let nb_records_to_delete = size_diff as f32 / size_of_val ( record_ptr ) as f32 ; for _ in 1 .. nb_records_to_delete as u32 { if ! self . record_buffer . is_empty ( ) { let res = self . record_buffer . remove ( 0 ) ; debug ! ( " " self id res ) ; } } } } }
Checks the size in memory of record_buffer and deletes as many Record
instances from the buffer to make it smaller in memory than buffer_max_kbytes.
Checks the size in memory of record_buffer and deletes as many Record instances from the buffer to make it smaller in memory than buffer_max_kbytes .
&mut self
&mut self