Skip to content

Commit dd398a6

Browse files
committed
Fix comment
1 parent d45cf03 commit dd398a6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/reseeding.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,13 @@ where R: BlockRngCore<u32> + SeedableRng,
130130

131131
fn generate(&mut self, results: &mut Self::Results) -> Result<(), Error> {
132132
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.
136140
return self.reseed_and_generate(results);
137141
}
138142
self.bytes_until_reseed -= results.as_ref().len() as i64 * 4;

0 commit comments

Comments
 (0)