From 973d3bc0a7fbca734d47dc513314e6d80a366d59 Mon Sep 17 00:00:00 2001 From: BeyondWUXF <46481385+BeyondWUXF@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:30:10 +0800 Subject: [PATCH] =?UTF-8?q?reportNode=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NodeServer/ServerManager.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/NodeServer/ServerManager.cpp b/NodeServer/ServerManager.cpp index ea00bb0..290bc70 100644 --- a/NodeServer/ServerManager.cpp +++ b/NodeServer/ServerManager.cpp @@ -236,8 +236,10 @@ void ServerManager::run() time_t now = TNOWMS; vector endPointList = Application::getCommunicator()->getEndpoint4All(_adminObj); - for(auto endPoint : endPointList) + set adminHosts; + for(auto &endPoint : endPointList) { + adminHosts.emplace(endPoint.getHost()); auto find = _adminPrxs.find(endPoint.getHost()); if(find == _adminPrxs.end()) { @@ -255,16 +257,22 @@ void ServerManager::run() auto itPrx = _adminPrxs.begin(); while (itPrx != _adminPrxs.end()) { + if(adminHosts.find(itPrx->first) == adminHosts.end()) + { + itPrx = _adminPrxs.erase(itPrx); + continue; + } + try { itPrx->second->reportNode(rn); - ++itPrx; } catch(exception &ex) { TLOG_ERROR("report admin, error:" << ex.what() << endl); - itPrx = _adminPrxs.erase(itPrx); } + + ++itPrx; } int64_t diff = timeout-(TNOWMS-now);