diff --git a/include/opendht/dhtrunner.h b/include/opendht/dhtrunner.h index 9a78d75d..cc3a5583 100644 --- a/include/opendht/dhtrunner.h +++ b/include/opendht/dhtrunner.h @@ -211,6 +211,14 @@ public: return dht_->getSearchesLog(af); } + // securedht methods + + void findCertificate(InfoHash hash, std::function)>); + void registerCertificate(std::shared_ptr cert) { + std::lock_guard lck(dht_mtx); + dht_->registerCertificate(cert); + } + /** * If threaded is false, loop() must be called periodically. */ diff --git a/src/dhtrunner.cpp b/src/dhtrunner.cpp index 83cb9ec6..eba77862 100644 --- a/src/dhtrunner.cpp +++ b/src/dhtrunner.cpp @@ -404,5 +404,13 @@ DhtRunner::bootstrap(const std::vector& nodes) cv.notify_all(); } +void +DhtRunner::findCertificate(InfoHash hash, std::function)> cb) { + std::lock_guard lck(storage_mtx); + pending_ops.emplace([=](SecureDht& dht) { + dht.findCertificate(hash, cb); + }); + cv.notify_all(); +} }