From 9ece1c0e25fda0725337b636e32d0d5884eea027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Tue, 22 Aug 2023 14:35:28 -0400 Subject: [PATCH] jamiaccount: init CertStore before dht and connectionManager Prevents various crashes and issues Change-Id: Id0299a47263ae1e8bb057c9f6779ff2678adfc6f --- src/jamidht/jamiaccount.cpp | 2 +- src/jamidht/jamiaccount.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index 86f68a5adb..0fe2858d4b 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -269,13 +269,13 @@ dhtStatusStr(dht::NodeStatus status) JamiAccount::JamiAccount(const std::string& accountId) : SIPAccountBase(accountId) + , certStore_ {std::make_unique<dhtnet::tls::CertificateStore>(idPath_, Logger::dhtLogger())} , dht_(new dht::DhtRunner) , idPath_(fileutils::get_data_dir() + DIR_SEPARATOR_STR + accountId) , cachePath_(fileutils::get_cache_dir() + DIR_SEPARATOR_STR + accountId) , dataPath_(cachePath_ + DIR_SEPARATOR_STR "values") , connectionManager_ {} , nonSwarmTransferManager_(std::make_shared<TransferManager>(accountId, "")) - , certStore_ {std::make_unique<dhtnet::tls::CertificateStore>(idPath_, Logger::dhtLogger())} {} JamiAccount::~JamiAccount() noexcept diff --git a/src/jamidht/jamiaccount.h b/src/jamidht/jamiaccount.h index 9c74d49bda..dc85f45279 100644 --- a/src/jamidht/jamiaccount.h +++ b/src/jamidht/jamiaccount.h @@ -702,6 +702,7 @@ private: std::string registeredName_; #endif std::shared_ptr<dht::Logger> logger_; + std::unique_ptr<dhtnet::tls::CertificateStore> certStore_; std::shared_ptr<dht::DhtRunner> dht_ {}; std::unique_ptr<AccountManager> accountManager_; @@ -876,8 +877,6 @@ private: std::unique_ptr<SyncModule> syncModule_; void initConnectionManager(); - - std::unique_ptr<dhtnet::tls::CertificateStore> certStore_; }; static inline std::ostream& -- GitLab