adapt to avoid blocking calls

This commit is contained in:
Sven Czarnian
2021-11-25 22:26:26 +01:00
parent f2f68708ac
commit 1594be8dc1

View File

@@ -34,6 +34,9 @@ bool Backend::initialize(const Communication& configuration) {
return false;
if (false == this->setSocketKey(configuration.clientPrivateIdentifier, zmq::sockopt::curve_secretkey))
return false;
this->m_socket->set(zmq::sockopt::rcvtimeo, 500);
this->m_socket->set(zmq::sockopt::req_correlate, 1);
this->m_socket->set(zmq::sockopt::req_relaxed, 1);
/* connect to the server */
try {
@@ -68,7 +71,6 @@ std::shared_ptr<aman::AircraftSequence> Backend::receiveSequence() {
return nullptr;
try {
//auto result = this->m_socket->recv(message, zmq::recv_flags::dontwait);
auto result = this->m_socket->recv(message);
if (false == result.has_value() || 0 == result.value())
return nullptr;