Skip to content
Snippets Groups Projects
Commit 5170f76d authored by Amna Snene's avatar Amna Snene
Browse files

tools: remove ioContextRunner

Change-Id: I0ce66802ef962d8ff01ffea800224b2d2ed72ac4
parent 084d8a3a
No related branches found
No related tags found
No related merge requests found
......@@ -67,15 +67,6 @@ Dnc::Dnc(dht::crypto::Identity identity,
ioContext(std::make_shared<asio::io_context>()),
iceFactory(std::make_shared<IceTransportFactory>(logger))
{
ioContextRunner = std::thread([context = ioContext, logger = logger] {
try {
auto work = asio::make_work_guard(*context);
context->run();
} catch (const std::exception& ex) {
if (logger)
logger->error("Error in ioContextRunner: {}", ex.what());
}
});
certStore = std::make_shared<tls::CertificateStore>(cachePath()/"certStore", logger);
trustStore = std::make_shared<tls::TrustStore>(*certStore);
......@@ -254,6 +245,5 @@ Dnc::run()
Dnc::~Dnc()
{
ioContext->stop();
ioContextRunner.join();
}
} // namespace dhtnet
......@@ -65,7 +65,6 @@ private:
std::shared_ptr<tls::CertificateStore> certStore;
std::shared_ptr<IceTransportFactory> iceFactory;
std::shared_ptr<asio::io_context> ioContext;
std::thread ioContextRunner;
std::shared_ptr<tls::TrustStore> trustStore;
std::pair<std::string, std::string> parseName(const std::string_view name);
......
......@@ -92,22 +92,12 @@ dhtnet::Dsh::Dsh(dht::crypto::Identity identity,
const std::string& turn_pass,
const std::string& turn_realm,
bool anonymous)
:logger(dht::log::getStdLogger())
, ioContext(std::make_shared<asio::io_context>()),
:logger(dht::log::getStdLogger()),
ioContext(std::make_shared<asio::io_context>()),
iceFactory(std::make_shared<IceTransportFactory>(logger)),
certStore(std::make_shared<tls::CertificateStore>(cachePath()/"certstore", logger)),
trustStore(std::make_shared<tls::TrustStore>(*certStore))
{
ioContext = std::make_shared<asio::io_context>();
ioContextRunner = std::thread([context = ioContext, logger = logger] {
try {
auto work = asio::make_work_guard(*context);
context->run();
} catch (const std::exception& ex) {
if (logger)
logger->error("Error in ioContextRunner: {}", ex.what());
}
});
auto ca = identity.second->issuer;
trustStore->setCertificateStatus(ca->getId().toString(), tls::TrustStore::PermissionStatus::ALLOWED);
// Build a server
......@@ -272,7 +262,6 @@ dhtnet::Dsh::run()
dhtnet::Dsh::~Dsh()
{
ioContext->stop();
ioContextRunner.join();
}
} // namespace dhtnet
\ No newline at end of file
......@@ -52,7 +52,6 @@ private:
std::shared_ptr<tls::CertificateStore> certStore {nullptr};
std::shared_ptr<dhtnet::IceTransportFactory> iceFactory {nullptr};
std::shared_ptr<asio::io_context> ioContext;
std::thread ioContextRunner;
std::shared_ptr<tls::TrustStore> trustStore;
};
......
......@@ -169,15 +169,6 @@ dhtnet::Dvpn::Dvpn(dht::crypto::Identity identity,
certStore(std::make_shared<tls::CertificateStore>(cachePath()/"certstore", logger)),
trustStore(std::make_shared<tls::TrustStore>(*certStore))
{
ioContextRunner = std::thread([context = ioContext, logger = logger] {
try {
auto work = asio::make_work_guard(*context);
context->run();
} catch (const std::exception& ex) {
if (logger)
logger->error("Error in ioContextRunner: {}", ex.what());
}
});
auto ca = identity.second->issuer;
trustStore->setCertificateStatus(ca->getId().toString(), tls::TrustStore::PermissionStatus::ALLOWED);
......@@ -386,5 +377,4 @@ dhtnet::Dvpn::run()
dhtnet::Dvpn::~Dvpn()
{
ioContext->stop();
ioContextRunner.join();
}
......@@ -63,7 +63,6 @@ public:
std::shared_ptr<tls::CertificateStore> certStore;
std::shared_ptr<IceTransportFactory> iceFactory;
std::shared_ptr<asio::io_context> ioContext;
std::thread ioContextRunner;
enum class CommunicationState { METADATA, DATA };
std::shared_ptr<tls::TrustStore> trustStore;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment