@@ -2,14 +2,13 @@ use std::any::Any;
22use std:: fmt:: Debug ;
33use std:: sync:: Arc ;
44
5- use rand:: rngs :: { StdRng , SysRng } ;
6- use rand :: { Rng , RngExt , SeedableRng } ;
5+ use rand:: { RngExt , SeedableRng } ;
6+ use rand_pcg :: Pcg32 ;
77
88use crate :: congestion:: ControllerMetrics ;
99use crate :: congestion:: bbr:: bw_estimation:: BandwidthEstimation ;
1010use crate :: congestion:: bbr:: min_max:: MinMax ;
1111use crate :: connection:: RttEstimator ;
12- use crate :: endpoint:: NoRandomBytes ;
1312use crate :: { Duration , Instant } ;
1413
1514use super :: { BASE_DATAGRAM_SIZE , Controller , ControllerFactory } ;
@@ -58,14 +57,14 @@ pub struct Bbr {
5857 bw_at_last_round : u64 ,
5958 round_wo_bw_gain : u64 ,
6059 ack_aggregation : AckAggregationState ,
61- random_number_generator : StdRng ,
60+ random_number_generator : Pcg32 ,
6261}
6362
6463impl Bbr {
6564 /// Construct a state using the given `config` and current time `now`
66- pub fn new ( config : Arc < BbrConfig > , current_mtu : u16 ) -> Result < Self , NoRandomBytes > {
65+ pub fn new ( config : Arc < BbrConfig > , current_mtu : u16 ) -> Self {
6766 let initial_window = config. initial_window ;
68- Ok ( Self {
67+ Self {
6968 config,
7069 current_mtu : current_mtu as u64 ,
7170 max_bandwidth : BandwidthEstimation :: default ( ) ,
@@ -99,8 +98,8 @@ impl Bbr {
9998 bw_at_last_round : 0 ,
10099 round_wo_bw_gain : 0 ,
101100 ack_aggregation : AckAggregationState :: default ( ) ,
102- random_number_generator : StdRng :: try_from_rng ( & mut SysRng ) ? ,
103- } )
101+ random_number_generator : Pcg32 :: from_rng ( & mut rand :: rng ( ) ) ,
102+ }
104103 }
105104
106105 fn enter_startup_mode ( & mut self ) {
0 commit comments