From 4e5cb7960ce4e7e66d5190be67426aeca8b55c3d Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期五, 09 四月 2021 18:45:08 +0800 Subject: [PATCH] add heartbeat, not tested yet. --- utest/utest.cpp | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/utest/utest.cpp b/utest/utest.cpp index f88eab9..a178fab 100644 --- a/utest/utest.cpp +++ b/utest/utest.cpp @@ -9,6 +9,7 @@ #include <string> #include <thread> #include <vector> + using namespace bhome_msg; template <class A, class B> @@ -90,8 +91,11 @@ const int timeout = 1000; auto Sub = [&](int id, const std::vector<std::string> &topics) { DemoNode client("client_" + std::to_string(id), shm); - - bool r = client.Subscribe(topics, timeout); + MsgTopicList tlist; + for (auto &t : topics) { + tlist.add_topic_list(t); + } + bool r = client.Subscribe(tlist, timeout); if (!r) { printf("client subscribe failed.\n"); } @@ -227,12 +231,12 @@ }; server.ServerStart(onData); - MsgRegisterRPC rpc; + MsgTopicList rpc; for (auto &topic : topics) { - rpc.add_topics(topic); + rpc.add_topic_list(topic); } MsgCommonReply reply_body; - if (!server.RegisterRPC(rpc, reply_body, 100)) { + if (!server.ServerRegisterRPC(rpc, reply_body, 100)) { printf("server register topic failed\n"); return; } -- Gitblit v1.8.0