lichao
2021-05-20 6b96ee857e366af317ab9dc1b6b4f9c22576e83b
src/topic_node.cpp
@@ -17,6 +17,7 @@
 */
#include "topic_node.h"
#include "bh_util.h"
#include "sleeper.h"
#include <chrono>
#include <list>
@@ -51,7 +52,6 @@
TopicNode::~TopicNode()
{
   LOG_DEBUG() << "~TopicNode()";
   Stop();
}
@@ -140,9 +140,7 @@
}
void TopicNode::Stop()
{
   LOG_DEBUG() << "Node Stopping";
   for (auto &p : sockets_) { p->Stop(); }
   LOG_INFO() << "Node Stopped";
}
bool TopicNode::Register(ProcInfo &proc, MsgCommonReply &reply_body, const int timeout_ms)
@@ -399,10 +397,11 @@
   }
   BHMsgHead head;
   std::string body;
   FibUSleeper sleeper(1000 * 10);
   auto end_time = steady_clock::now() + milliseconds(timeout_ms);
   while (!server_buffer_->Read(head, body)) {
      if (steady_clock::now() < end_time) {
         robust::QuickSleep();
         sleeper.Sleep();
      } else {
         return false;
      }
@@ -677,10 +676,11 @@
   BHMsgHead head;
   std::string body;
   FibUSleeper sleeper(1000 * 10);
   auto end_time = steady_clock::now() + milliseconds(timeout_ms);
   while (!sub_buffer_->Read(head, body)) {
      if (steady_clock::now() < end_time) {
         robust::QuickSleep();
         sleeper.Sleep();
      } else {
         return false;
      }