From 1b167ec5ad101ac44451381e26cc73ab5d67d2a1 Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期一, 26 四月 2021 16:37:52 +0800 Subject: [PATCH] fix socket busy loop; del locked readall; refactor. --- box/center.cpp | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/box/center.cpp b/box/center.cpp index 829a089..5cb9bc3 100644 --- a/box/center.cpp +++ b/box/center.cpp @@ -133,12 +133,12 @@ UpdateRegInfo(node); nodes_[ssn] = node; - printf("new ssn %ld\n", ssn); + printf("new node (%s) ssn (%ld)\n", head.proc_id().c_str(), ssn); auto old = online_node_addr_map_.find(head.proc_id()); if (old != online_node_addr_map_.end()) { // old session auto &old_ssn = old->second; nodes_[old_ssn]->state_.PutOffline(offline_time_); - printf("put %s %ld offline\n", nodes_[old_ssn]->proc_.proc_id().c_str(), old->second); + printf("put node (%s) ssn (%ld) offline\n", nodes_[old_ssn]->proc_.proc_id().c_str(), old->second); old_ssn = ssn; } else { online_node_addr_map_.emplace(head.proc_id(), ssn); @@ -201,6 +201,10 @@ for (auto &topic : topics) { service_map_[topic].insert(dest); } + printf("node %s ssn %ld serve %d topics:\n", node->proc_.proc_id().c_str(), *node->addrs_.begin(), topics.size()); + for (auto &topic : topics) { + printf("\t %s\n", topic.c_str()); + } return MakeReply(eSuccess); }); } -- Gitblit v1.8.0