File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -579,23 +579,23 @@ impl CryptoConnection {
579579 let mut total_resent = 0 ;
580580 for i in 0 .. CONGESTION_QUEUE_ARRAY_SIZE {
581581 let i = ( n_p_pos + ( CONGESTION_MAX_DELAY - delay) + i) % CONGESTION_LAST_SENT_ARRAY_SIZE ;
582- total_sent += self . last_num_packets_sent [ i] ;
583- total_resent += self . last_num_packets_resent [ i] ;
582+ total_sent += self . last_num_packets_sent [ i] as i32 ;
583+ total_resent += self . last_num_packets_resent [ i] as i32 ;
584584 }
585585
586586 if sum > 0 {
587587 // send_array increased i.e. we sent more packets that was delivered
588588 // decrease total_sent packets by this number so that it includes only delivered packets
589- total_sent -= sum as u32 ;
590- } else if total_resent > -sum as u32 {
589+ total_sent -= sum;
590+ } else if total_resent > -sum {
591591 // send_array decreased and not all resent packets were delivered
592592 // use this number to count only delivered packets
593- total_resent = -sum as u32 ;
593+ total_resent = -sum;
594594 }
595595
596596 // Average number of successfully delivered packets per second
597597 let coeff = 1000.0 / ( CONGESTION_QUEUE_ARRAY_SIZE as f64 * PACKET_COUNTER_AVERAGE_INTERVAL_MS as f64 ) ;
598- let min_speed = f64:: from ( total_sent) * coeff;
598+ let min_speed = ( f64:: from ( total_sent) * coeff) . max ( CRYPTO_PACKET_MIN_RATE ) ;
599599 let min_speed_request = f64:: from ( total_sent + total_resent) * coeff;
600600
601601 // Time necessary to send all packets from send queue
You can’t perform that action at this time.
0 commit comments