ADD: added clocalClientsClass and ping pong check
This commit is contained in:
@@ -2,10 +2,12 @@
|
||||
|
||||
|
||||
#include "WHISPER/whisper.hpp"
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <WHISPER/localClients.hpp>
|
||||
|
||||
#define ZMQ_BUILD_DRAFT_API 1
|
||||
#include <zmq.hpp>
|
||||
@@ -14,14 +16,14 @@
|
||||
namespace WHISPER {
|
||||
|
||||
|
||||
struct localClient{
|
||||
std::uint32_t port;
|
||||
std::string addr;
|
||||
std::uint32_t parentid;
|
||||
std::uint32_t id;
|
||||
zmq::socket_t clientSocket;
|
||||
std::time_t lastResponse;
|
||||
};
|
||||
// struct localClient{
|
||||
// std::uint32_t port;
|
||||
// std::string addr;
|
||||
// std::uint32_t parentid;
|
||||
// std::uint32_t id;
|
||||
// zmq::socket_t clientSocket;
|
||||
// std::time_t lastResponse;
|
||||
// };
|
||||
|
||||
|
||||
|
||||
@@ -50,9 +52,13 @@ namespace WHISPER {
|
||||
std::shared_ptr<zmq::socket_t> loopbackSocket = nullptr;
|
||||
/// vector of local udp clients
|
||||
std::list<std::shared_ptr<localClient>> localclients;
|
||||
|
||||
|
||||
|
||||
std::atomic<bool> stopClientChecker = false;
|
||||
std::atomic<bool> clientCheckerisRunning = false;
|
||||
|
||||
std::thread clientsCheckerThread;
|
||||
|
||||
|
||||
/**
|
||||
* @brief checks if the given port is already is use
|
||||
@@ -69,7 +75,11 @@ namespace WHISPER {
|
||||
void derivedUnsubscribe(std::string topic) override;
|
||||
|
||||
void sendToLocalClients(std::string msg,std::string topic);
|
||||
|
||||
|
||||
|
||||
void startChecker();
|
||||
void stopChecker();
|
||||
void checkClients();
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user