From 6aa7e4c37a70709e7348bd16407c5983a563ed76 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期一, 29 三月 2021 21:11:34 +0800
Subject: [PATCH] test pub/sub msg; fix update last_time;

---
 src/msg.cpp |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/msg.cpp b/src/msg.cpp
index ed8adba..78834a8 100644
--- a/src/msg.cpp
+++ b/src/msg.cpp
@@ -37,7 +37,6 @@
     assert(data && size);
     BHMsg msg(InitMsg(kMsgTypeRequest));
     msg.set_body(data, size);
-    BHAddress addr;
     msg.add_route()->set_mq_id(&src_id, sizeof(src_id));
     return msg;
 }
@@ -50,10 +49,11 @@
     return msg;
 }
 
-BHMsg MakeSubUnsub(const std::vector<std::string> &topics, const MsgType sub_unsub)
+BHMsg MakeSubUnsub(const MQId &client, const std::vector<std::string> &topics, const MsgType sub_unsub)
 {
     assert(sub_unsub == kMsgTypeSubscribe || sub_unsub == kMsgTypeUnsubscribe);
     BHMsg msg(InitMsg(sub_unsub));
+    msg.add_route()->set_mq_id(&client, sizeof(client));
     DataSub subs;
     for (auto &t : topics) {
         subs.add_topics(t);
@@ -62,8 +62,8 @@
     return msg;
 }
 
-BHMsg MakeSub(const std::vector<std::string> &topics) { return MakeSubUnsub(topics, kMsgTypeSubscribe); }
-BHMsg MakeUnsub(const std::vector<std::string> &topics) { return MakeSubUnsub(topics, kMsgTypeUnsubscribe); }
+BHMsg MakeSub(const MQId &client, const std::vector<std::string> &topics) { return MakeSubUnsub(client, topics, kMsgTypeSubscribe); }
+BHMsg MakeUnsub(const MQId &client, const std::vector<std::string> &topics) { return MakeSubUnsub(client, topics, kMsgTypeUnsubscribe); }
 
 BHMsg MakePub(const std::string &topic, const void *data, const size_t size)
 {

--
Gitblit v1.8.0