diff --git a/contrib/src/opendht/SHA512SUMS b/contrib/src/opendht/SHA512SUMS index 0629d8fd0b3d84eda23b65cc2c7547bcc4dc5d8b..c749f4bf0de6c8bb64a404974fa5109efdab508a 100644 --- a/contrib/src/opendht/SHA512SUMS +++ b/contrib/src/opendht/SHA512SUMS @@ -1 +1 @@ -692b098219f8da244ecc2fd89f215704bd0e097650fb6b1dced2400a52d4c53bc4bceaa15875772e8a4b4d55ccd6766c53c80417cd2bda3b42a32b74d1687981 opendht-14d882d22024310a7a2b1098b7dc39523f9fd592.tar.gz \ No newline at end of file +75d3da56bb9cb4ccc3afcb29b68a19f551f7a0f10193bf9a6efb2acaed2b4243c39daf96d8ab4e080596d44e15da1198a91cfaa7cd457ccdbb3d10a08f9b5fb0 opendht-2.2.0.tar.gz \ No newline at end of file diff --git a/contrib/src/opendht/package.json b/contrib/src/opendht/package.json index 7fe6ce32d55ba3590fccdb71857554d5095398b7..caaf490eaf1821b011d046a62984d13ec6f52aab 100644 --- a/contrib/src/opendht/package.json +++ b/contrib/src/opendht/package.json @@ -1,6 +1,6 @@ { "name": "opendht", - "version": "14d882d22024310a7a2b1098b7dc39523f9fd592", + "version": "2.2.0", "url": "https://github.com/savoirfairelinux/opendht/archive/__VERSION__.tar.gz", "deps": [ "argon2", diff --git a/contrib/src/opendht/rules.mak b/contrib/src/opendht/rules.mak index efffa6fe4747f7ad3649da39ba1b2a176d9093aa..43e0c64fe1b8ba392bf15a2dacf74bfcceff2e8d 100644 --- a/contrib/src/opendht/rules.mak +++ b/contrib/src/opendht/rules.mak @@ -1,5 +1,5 @@ # OPENDHT -OPENDHT_VERSION := 14d882d22024310a7a2b1098b7dc39523f9fd592 +OPENDHT_VERSION := 2.2.0 OPENDHT_URL := https://github.com/savoirfairelinux/opendht/archive/$(OPENDHT_VERSION).tar.gz PKGS += opendht diff --git a/src/jamidht/archive_account_manager.cpp b/src/jamidht/archive_account_manager.cpp index 661df6347407734c96dba6e1cc8d7d4154c6e50c..e9193d1bfc8e5b62102d0077b66661c3584b4a6a 100644 --- a/src/jamidht/archive_account_manager.cpp +++ b/src/jamidht/archive_account_manager.cpp @@ -758,7 +758,7 @@ ArchiveAccountManager::registerName(const std::string& password, try { auto archive = readArchive(password); auto privateKey = archive.id.first; - auto pk = privateKey->getPublicKey(); + const auto& pk = privateKey->getPublicKey(); publickey = pk.toString(); accountId = pk.getId().toString(); signedName = base64::encode( diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index 20bf2888646bf2ca73a69bdf57a91f8dd70b5c0f..c5a9cc9d8abbda7bc965e3ac4d884e66a58076a0 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -2487,11 +2487,17 @@ JamiAccount::doUnregister(std::function<void(bool)> released_cb) return; } + std::mutex mtx; + std::condition_variable cv; + bool shutdown_complete {false}; + JAMI_WARN("[Account %s] unregistering account %p", getAccountID().c_str(), this); - dht_->shutdown([this] { + dht_->shutdown([&] { JAMI_WARN("[Account %s] dht shutdown complete", getAccountID().c_str()); - setRegistrationState(RegistrationState::UNREGISTERED); - }); + std::lock_guard<std::mutex> lock(mtx); + shutdown_complete = true; + cv.notify_all(); + }, false); { std::lock_guard<std::mutex> lk(pendingCallsMutex_); @@ -2505,13 +2511,18 @@ JamiAccount::doUnregister(std::function<void(bool)> released_cb) shutdownConnections(); } - dht_->join(); - // Release current upnp mapping if any. if (upnpCtrl_ and dhtUpnpMapping_.isValid()) { upnpCtrl_->releaseMapping(dhtUpnpMapping_); } + { + std::unique_lock<std::mutex> lock(mtx); + cv.wait(lock, [&]{ return shutdown_complete; }); + } + dht_->join(); + setRegistrationState(RegistrationState::UNREGISTERED); + lock.unlock(); if (released_cb)