From bb9a7e348892eb5c4fccb063380aa6fcd9612b71 Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期二, 06 四月 2021 17:32:35 +0800 Subject: [PATCH] server resend failed; rename msgs; refactor. --- src/topic_request.h | 32 +++++--------------------------- 1 files changed, 5 insertions(+), 27 deletions(-) diff --git a/src/reqrep.h b/src/topic_request.h similarity index 76% rename from src/reqrep.h rename to src/topic_request.h index 8a4743c..6765dc2 100644 --- a/src/reqrep.h +++ b/src/topic_request.h @@ -1,9 +1,9 @@ /* * ===================================================================================== * - * Filename: reqrep.h + * Filename: topic_request.h * - * Description: topic request/reply sockets + * Description: topic request socket * * Version: 1.0 * Created: 2021骞�04鏈�01鏃� 09鏃�36鍒�06绉� @@ -15,8 +15,8 @@ * * ===================================================================================== */ -#ifndef REQREP_ACEH09NK -#define REQREP_ACEH09NK +#ifndef TOPIC_REQUEST_ACEH09NK +#define TOPIC_REQUEST_ACEH09NK #include "bh_util.h" #include "defs.h" @@ -105,26 +105,4 @@ TopicCache topic_cache_; }; -class SocketReply : private ShmSocket -{ - typedef ShmSocket Socket; - -public: - SocketReply(Socket::Shm &shm) : - Socket(shm, 64) {} - SocketReply() : - SocketReply(BHomeShm()) {} - ~SocketReply() { Stop(); } - - typedef std::function<bool(const std::string &topic, const std::string &data, std::string &reply)> OnRequest; - bool StartWorker(const OnRequest &rcb, int nworker = 2); - bool Stop() { return Socket::Stop(); } - bool RecvRequest(void *&src_info, std::string &topic, std::string &data, const int timeout_ms); - bool SendReply(void *src_info, const std::string &data, const int timeout_ms); - bool Register(const ProcInfo &proc_info, const std::vector<std::string> &topics, const int timeout_ms); - bool Heartbeat(const ProcInfo &proc_info, const int timeout_ms); - -private: -}; - -#endif // end of include guard: REQREP_ACEH09NK +#endif // end of include guard: TOPIC_REQUEST_ACEH09NK -- Gitblit v1.8.0