Skip to content

Commit

Permalink
Merge pull request #141 from BeyondWUXF/hotfix/BeyondWUXF/tarsnode_re…
Browse files Browse the repository at this point in the history
…port

Update ServerManager.cpp
  • Loading branch information
ruanshudong authored Nov 14, 2023
2 parents 447a8a7 + 973d3bc commit 4937b7f
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions NodeServer/ServerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,10 @@ void ServerManager::run()
time_t now = TNOWMS;

vector<TC_Endpoint> endPointList = Application::getCommunicator()->getEndpoint4All(_adminObj);
for(auto endPoint : endPointList)
set<string> adminHosts;
for(auto &endPoint : endPointList)
{
adminHosts.emplace(endPoint.getHost());
auto find = _adminPrxs.find(endPoint.getHost());
if(find == _adminPrxs.end())
{
Expand All @@ -252,17 +254,26 @@ void ServerManager::run()

}

for(auto adminPrx : _adminPrxs)
{
auto itPrx = _adminPrxs.begin();
while (itPrx != _adminPrxs.end())
{
if(adminHosts.find(itPrx->first) == adminHosts.end())
{
itPrx = _adminPrxs.erase(itPrx);
continue;
}

try
{
adminPrx.second->reportNode(rn);
{
itPrx->second->reportNode(rn);
}
catch(exception &ex)
{
TLOG_ERROR("report admin, error:" << ex.what() << endl);
}
}

++itPrx;
}

int64_t diff = timeout-(TNOWMS-now);

Expand Down Expand Up @@ -897,4 +908,4 @@ int ServerManager::forceDockerLogin(vector<string> &result)
result = g_app.getDockerPullThread()->checkDockerRegistries();

return 0;
}
}

0 comments on commit 4937b7f

Please sign in to comment.