mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
dhtrunner: expose some securedht methods
This commit is contained in:
1 parent
4438df238e
commit
f61c2a234c
2 files changed
+16
No files matched your search
@@ -211,6 +211,14 @@ public:
|
||||
return dht_->getSearchesLog(af);
|
||||
}
|
||||
|
||||
// securedht methods
|
||||
|
||||
void findCertificate(InfoHash hash, std::function<void(const std::shared_ptr<crypto::Certificate>)>);
|
||||
void registerCertificate(std::shared_ptr<crypto::Certificate> cert) {
|
||||
std::lock_guard<std::mutex> lck(dht_mtx);
|
||||
dht_->registerCertificate(cert);
|
||||
}
|
||||
|
||||
/**
|
||||
* If threaded is false, loop() must be called periodically.
|
||||
*/
|
||||
|
||||
@@ -404,5 +404,13 @@ DhtRunner::bootstrap(const std::vector<Dht::NodeExport>& nodes)
|
||||
cv.notify_all();
|
||||
}
|
||||
|
||||
void
|
||||
DhtRunner::findCertificate(InfoHash hash, std::function<void(const std::shared_ptr<crypto::Certificate>)> cb) {
|
||||
std::lock_guard<std::mutex> lck(storage_mtx);
|
||||
pending_ops.emplace([=](SecureDht& dht) {
|
||||
dht.findCertificate(hash, cb);
|
||||
});
|
||||
cv.notify_all();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user