From c28cdf2fbf1565709b359c9cca6c5e29d9592dce Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期五, 02 四月 2021 15:51:20 +0800
Subject: [PATCH] typedef Topic.

---
 src/pubsub.cpp |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/pubsub.cpp b/src/pubsub.cpp
index cfc77ab..8d26e0b 100644
--- a/src/pubsub.cpp
+++ b/src/pubsub.cpp
@@ -22,7 +22,7 @@
 using namespace std::chrono_literals;
 using namespace bhome_msg;
 
-bool SocketPublish::Publish(const std::string &topic, const void *data, const size_t size, const int timeout_ms)
+bool SocketPublish::Publish(const Topic &topic, const void *data, const size_t size, const int timeout_ms)
 {
 	try {
 		MsgI imsg;
@@ -30,16 +30,16 @@
 			return false;
 		}
 		DEFER1(imsg.Release(shm()));
-		return ShmMsgQueue::Send(shm(), kBHBusQueueId, imsg, timeout_ms);
+		return ShmMsgQueue::Send(shm(), kBHTopicBus, imsg, timeout_ms);
 	} catch (...) {
 		return false;
 	}
 }
 
-bool SocketSubscribe::Subscribe(const std::vector<std::string> &topics, const int timeout_ms)
+bool SocketSubscribe::Subscribe(const std::vector<Topic> &topics, const int timeout_ms)
 {
 	try {
-		return mq().Send(kBHBusQueueId, MakeSub(mq().Id(), topics), timeout_ms);
+		return mq().Send(kBHTopicBus, MakeSub(mq().Id(), topics), timeout_ms);
 	} catch (...) {
 		return false;
 	}
@@ -61,7 +61,7 @@
 	return tdcb && Start(AsyncRecvProc, nworker);
 }
 
-bool SocketSubscribe::RecvSub(std::string &topic, std::string &data, const int timeout_ms)
+bool SocketSubscribe::RecvSub(Topic &topic, std::string &data, const int timeout_ms)
 {
 	BHMsg msg;
 	if (SyncRecv(msg, timeout_ms) && msg.type() == kMsgTypePublish) {

--
Gitblit v1.8.0