pool: place recursive_mtx at the start of func

This commit is contained in:
surtur 2022-01-20 08:44:25 +01:00
parent 606527618d
commit 977a705cd3
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

View File

@ -30,6 +30,7 @@ auto Pool::initialize_pool(const unsigned int& id) -> void {
auto Pool::add_entropy(const unsigned int& source,
const std::vector<char>& event) -> int {
std::unique_lock<std::recursive_mutex> ul(ro_mtx_s);
const size_t event_size{sizeof(char) * event.size()};
const size_t max_event_size{32};
std::string event_str;
@ -84,7 +85,6 @@ auto Pool::add_entropy(const unsigned int& source,
append_s(digest);
}
std::unique_lock<std::recursive_mutex> ul(ro_mtx_s);
fmt::print("\t[i] s.length() (simple char count): {}\n"
"\t[i] get_s_byte_count() (byte count): {}\n"
"\t[i] pool_id: {}\n"
@ -94,7 +94,6 @@ auto Pool::add_entropy(const unsigned int& source,
this->pool_id,
// "");
this->s);
ul.unlock();
}
catch (const std::exception& e) {
fmt::print("[!] pool(add_entropy): {}\n", e.what());