Browse Source

adapt to avoid blocking calls

Sven Czarnian 3 years ago
parent
commit
1594be8dc1
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/com/Backend.cpp

+ 3 - 1
src/com/Backend.cpp

@@ -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;