From 58d904a328c0d849769b483e901a0be9426b8209 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期二, 20 七月 2021 20:20:44 +0800 Subject: [PATCH] 调整Request C.BHFree的位置 --- src/topic_node.h | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/topic_node.h b/src/topic_node.h index 3d6767b..9e7eed2 100644 --- a/src/topic_node.h +++ b/src/topic_node.h @@ -39,7 +39,7 @@ const MQInfo &BusAddr() const { return BHTopicBusAddress(shm()); } public: - TopicNode(SharedMemory &shm); + TopicNode(SharedMemory &shm, MQId ssn_id = 0); ~TopicNode(); // topic node @@ -73,7 +73,15 @@ // subscribe typedef std::function<void(const std::string &proc_id, const MsgPublish &data)> SubDataCB; bool SubscribeStartWorker(const SubDataCB &tdcb, int nworker = 2); - bool Subscribe(MsgTopicList &topics, MsgCommonReply &reply_body, const int timeout_ms); + bool Subscribe(MsgTopicList &topics, MsgCommonReply &reply_body, const int timeout_ms) + { + return DoSubscribe(topics, false, reply_body, timeout_ms); + } + bool SubscribeNet(MsgTopicList &topics, MsgCommonReply &reply_body, const int timeout_ms) + { + return DoSubscribe(topics, true, reply_body, timeout_ms); + } + bool DoSubscribe(MsgTopicList &topics, const bool net, MsgCommonReply &reply_body, const int timeout_ms); bool RecvSub(std::string &proc_id, MsgPublish &pub, const int timeout_ms); void Start(ServerAsyncCB const &server_cb, SubDataCB const &sub_cb, RequestResultCB &client_cb, int nworker = 2); @@ -163,8 +171,8 @@ bool Init(); bool Valid() const { return state() != eStateUninited; } std::mutex mutex_; - MQId ssn_id_ = 0; std::atomic<State> state_; + MQId ssn_id_ = 0; int proc_index_ = -1; TopicQueryCache topic_query_cache_; -- Gitblit v1.8.0