Skip to content
Snippets Groups Projects
Commit d8b6a405 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

ConnectionManager: allow to provide RNG through configuration

Change-Id: Ic24123e329b221f5f1e24d3df6f3cc93649c4591
parent d0c92c70
Branches
Tags
No related merge requests found
...@@ -321,6 +321,8 @@ struct ConnectionManager::Config ...@@ -321,6 +321,8 @@ struct ConnectionManager::Config
*/ */
bool getUPnPActive() const; bool getUPnPActive() const;
/** Optional pseudo random generator to be used, allowing to control the seed. */
std::unique_ptr<std::mt19937_64> rng;
}; };
} // namespace dhtnet } // namespace dhtnet
\ No newline at end of file
...@@ -381,7 +381,7 @@ class ConnectionManager::Impl : public std::enable_shared_from_this<ConnectionMa ...@@ -381,7 +381,7 @@ class ConnectionManager::Impl : public std::enable_shared_from_this<ConnectionMa
public: public:
explicit Impl(std::shared_ptr<ConnectionManager::Config> config_) explicit Impl(std::shared_ptr<ConnectionManager::Config> config_)
: config_ {std::move(createConfig(config_))} : config_ {std::move(createConfig(config_))}
, rand_ {dht::crypto::getSeededRandomEngine<std::mt19937_64>()} , rand_ {config_->rng ? *config_->rng : dht::crypto::getSeededRandomEngine<std::mt19937_64>()}
{ {
loadTreatedMessages(); loadTreatedMessages();
if(!config_->ioContext) { if(!config_->ioContext) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment