Closed michael-yxchen closed 11 months ago
Put up another version that always use Endpoint.rng
to seed Connection.rng
. Let me know if you like it this way, or prefer to obtain fresh randomness from the entropy pool if Endpoint.rng
is not seeded
quinn-proto::{Connection, Endpoint}
structs callStdRng::from_entropy()
in their implementation. It makes it hard to reproduce errors in an otherwise deterministic test case.This PR addresses the issue by adding a
StdRng
argument to the respectivenew
functions. For other functions that may create an endpoint/connection, an argument of typeimpl FnOnce() -> StdRng
is added. This avoids eager calls to generate fresh entropy. e.g. theEndpoint::handle
function is frequently called but we'd only need the rng when handling a new incoming connection.Fixes an unrelated lint error.
Closes #1684