Unverified Commit 3e969679 authored by kladko's avatar kladko

bug/SKALE-3751-enable-zeromq

parent eb1b2fa8
......@@ -95,7 +95,6 @@ void ZMQServer::run() {
workers.push_back(make_shared<ServerWorker>(*ctx_, ZMQ_DEALER,
this->checkSignature, this->caCert));
auto th = make_shared<std::thread>(std::bind(&ServerWorker::work, workers[i]));
th->detach();
worker_threads.push_back(th);
}
} catch (std::exception &e) {
......@@ -135,6 +134,12 @@ void ZMQServer::exitWorkers() {
worker->requestExit();
}
for (auto &&workerThread : worker_threads) {
workerThread->join();
}
spdlog::info("Workers exited");
// close server sockets
spdlog::info("Deleting threads ...");
......@@ -187,9 +192,6 @@ void ZMQServer::initZMQServer(bool _checkSignature) {
zmqServer = make_shared<ZMQServer>(_checkSignature, rootCAPath);
serverThread = make_shared<thread>(std::bind(&ZMQServer::run, ZMQServer::zmqServer));
serverThread->detach();
spdlog::info("Inited zmq server ...");
}
......@@ -197,6 +199,10 @@ shared_ptr <std::thread> ZMQServer::serverThread = nullptr;
ZMQServer::~ZMQServer() {
spdlog::info("Joining server thread");
serverThread->join();
spdlog::info("Joined server thread");
spdlog::info("Deleting server thread");
ZMQServer::serverThread = nullptr;
spdlog::info("Deleted server thread");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment