File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -130,9 +130,13 @@ where R: BlockRngCore<u32> + SeedableRng,
130
130
131
131
fn generate ( & mut self , results : & mut Self :: Results ) -> Result < ( ) , Error > {
132
132
if self . bytes_until_reseed <= 0 {
133
- // In the unlikely event the internal PRNG fails, we don't know
134
- // whether this is resolvable; schedule to reseed on next use and
135
- // return original error kind.
133
+ // We want to reseed here, and generate results later in the
134
+ // function. If generating results fail, we should return the error
135
+ // from that. If generating results succeeded, but reseeding failed,
136
+ // we should return the error from reseeding.
137
+ // The only way to get this behaviour without destroying performance
138
+ // was to split part of the function out into a
139
+ // `reseed_and_generate` method.
136
140
return self . reseed_and_generate ( results) ;
137
141
}
138
142
self . bytes_until_reseed -= results. as_ref ( ) . len ( ) as i64 * 4 ;
You can’t perform that action at this time.
0 commit comments