Skip to content

Commit

Permalink
Fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Mar 4, 2018
1 parent d45cf03 commit dd398a6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/reseeding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,13 @@ where R: BlockRngCore<u32> + SeedableRng,

fn generate(&mut self, results: &mut Self::Results) -> Result<(), Error> {
if self.bytes_until_reseed <= 0 {
// In the unlikely event the internal PRNG fails, we don't know
// whether this is resolvable; schedule to reseed on next use and
// return original error kind.
// We want to reseed here, and generate results later in the
// function. If generating results fail, we should return the error
// from that. If generating results succeeded, but reseeding failed,
// we should return the error from reseeding.
// The only way to get this behaviour without destroying performance
// was to split part of the function out into a
// `reseed_and_generate` method.
return self.reseed_and_generate(results);
}
self.bytes_until_reseed -= results.as_ref().len() as i64 * 4;
Expand Down

0 comments on commit dd398a6

Please sign in to comment.