dhtrunner: expose some securedht methods

This commit is contained in:
Adrien Béraud committed 2015-04-21 16:04:01 -04:00
1 parent 4438df238e
commit f61c2a234c
2 files changed
+16

No files matched your search

+8
View File
@@ -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.
*/
+8
View File
@@ -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();
}
}