lichao
2021-04-09 4e5cb7960ce4e7e66d5190be67426aeca8b55c3d
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;
      }