FIX: fixed the tcp client
This commit is contained in:
@@ -38,6 +38,9 @@ namespace DirectCommunication
|
|||||||
std::thread Worker_;
|
std::thread Worker_;
|
||||||
std::atomic_bool stopWorker_;
|
std::atomic_bool stopWorker_;
|
||||||
|
|
||||||
|
std::atomic_bool isConnected = true;
|
||||||
|
|
||||||
|
|
||||||
WHISPER::threadSafeQueue<std::string> receivedMessages_;
|
WHISPER::threadSafeQueue<std::string> receivedMessages_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ namespace DirectCommunication
|
|||||||
|
|
||||||
zmq::message_t zmqMsg(msg.begin(),msg.end());
|
zmq::message_t zmqMsg(msg.begin(),msg.end());
|
||||||
|
|
||||||
|
if (isConnected == true) {
|
||||||
socket_.send(zmqMsg,zmq::send_flags::dontwait);
|
socket_.send(zmqMsg,zmq::send_flags::dontwait);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -70,7 +72,7 @@ namespace DirectCommunication
|
|||||||
|
|
||||||
if (msg.to_string() == "CLOSE")
|
if (msg.to_string() == "CLOSE")
|
||||||
{
|
{
|
||||||
|
isConnected = false;
|
||||||
socket_.disconnect("tcp://"+serverAddress_+":"+std::to_string(port_));
|
socket_.disconnect("tcp://"+serverAddress_+":"+std::to_string(port_));
|
||||||
|
|
||||||
}else
|
}else
|
||||||
|
|||||||
Reference in New Issue
Block a user