Fixed polling issues when a server is erroring out and also peering the right id
This commit is contained in:
parent
140d58d0da
commit
405e43f672
@ -511,11 +511,8 @@ void HTTPSClientPool::pollPeerHealth(const std::string& server, const std::strin
|
||||
LogWrite(PEERING__ERROR, 0, "Peering", "%s: Error finding peer %s:%s.", __FUNCTION__, server.c_str(), port.c_str());
|
||||
}
|
||||
else {
|
||||
auto client = getOrCreateClient(id, port, server + ":" + port);
|
||||
auto client = getOrCreateClient(id, server, port);
|
||||
int16 interval = pollingInterval;
|
||||
while (running.load()) {
|
||||
interval++;
|
||||
if (interval > pollingInterval) {
|
||||
HealthStatus curStatus = peer_manager.getPeerStatus(server, web_worldport);
|
||||
id = peer_manager.isPeer(server, web_worldport);
|
||||
try {
|
||||
@ -656,13 +653,9 @@ void HTTPSClientPool::pollPeerHealth(const std::string& server, const std::strin
|
||||
}
|
||||
}
|
||||
LogWrite(PEERING__ERROR, 0, "Peering", "%s: ERROR POLLING %s:%s reason: %s", __FUNCTION__, server.c_str(), port.c_str(), e.what() ? e.what() : "??");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(400));
|
||||
}
|
||||
interval = 0;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HTTPSClientPool::pollPeerHealthData(auto client, const std::string& id, const std::string& server, const std::string& port) {
|
||||
@ -724,15 +717,19 @@ void HTTPSClientPool::startPolling() {
|
||||
std::async(std::launch::async, [this, server, port]() {
|
||||
try {
|
||||
pollPeerHealth(server, port);
|
||||
} catch (const std::exception& e) {
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
LogWrite(PEERING__DEBUG, 1, "Peering", "Exception in pollPeerHealth for %s:%s: %s", server.c_str(), port.c_str(), e.what());
|
||||
} catch (...) {
|
||||
}
|
||||
catch (...) {
|
||||
LogWrite(PEERING__DEBUG, 1, "Peering", "Unknown exception in pollPeerHealth for %s:%s.", server.c_str(), port.c_str());
|
||||
}
|
||||
});
|
||||
} catch (const std::exception& e) {
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
LogWrite(PEERING__DEBUG, 1, "Peering", "Failed to start async task for %s:%s: %s", server.c_str(), port.c_str(), e.what());
|
||||
} catch (...) {
|
||||
}
|
||||
catch (...) {
|
||||
LogWrite(PEERING__DEBUG, 1, "Peering", "Unknown exception when starting async task for %s:%s.", server.c_str(), port.c_str());
|
||||
}
|
||||
}
|
||||
|
@ -633,9 +633,14 @@ ThreadReturnType AchievmentLoad (void* tmp)
|
||||
}
|
||||
|
||||
ThreadReturnType StartPeerPoll (void* tmp)
|
||||
{
|
||||
|
||||
while( RunLoops )
|
||||
{
|
||||
LogWrite(WORLD__WARNING, 0, "Thread", "Start Polling...");
|
||||
peer_https_pool.startPolling();
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
}
|
||||
THREAD_RETURN(NULL);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user