fortuna: move whole ctor code into a try block
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-01-21 06:31:46 +01:00
parent c852c723fd
commit b24cf7566a
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

View File

@ -27,19 +27,20 @@ auto now{std::chrono::steady_clock::now()};
Fortuna::Fortuna() {
try {
initialize_prng();
this->sync_point.wait(); // wait for init
th_gen = std::thread(&Fortuna::generator_service,
this,
std::make_shared<fortuna::generator::Generator>());
th_accu = std::thread(&Fortuna::accumulator_service, this);
th_sfm = std::thread(&Fortuna::seed_file_manager_service, this);
th_urandom = std::thread(&Fortuna::urandom_entropy_src_service, this);
}
catch (CryptoPP::Exception& e) {
fmt::print(stderr, "{}\n", e.what());
// perhaps die on error
}
th_gen = std::thread(&Fortuna::generator_service,
this,
std::make_shared<fortuna::generator::Generator>());
th_accu = std::thread(&Fortuna::accumulator_service, this);
th_sfm = std::thread(&Fortuna::seed_file_manager_service, this);
th_urandom = std::thread(&Fortuna::urandom_entropy_src_service, this);
}
Fortuna::~Fortuna() noexcept {
if (th_gen.joinable()) {