fixes an issue that devmgr ping cloud server every second

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
SoftFever
2026-05-03 16:59:30 +08:00
parent 522343a193
commit 84d896bbd3
4 changed files with 15 additions and 6 deletions

View File

@@ -340,9 +340,17 @@ bool NetworkAgent::is_server_connected(const std::string& provider)
return false;
}
int NetworkAgent::refresh_connection()
int NetworkAgent::refresh_connection(const std::string& provider)
{
return invoke_on_all_cloud_agents(m_cloud_agents, [](ICloudServiceAgent& cloud_agent) { return cloud_agent.refresh_connection(); });
if(provider.empty())
return invoke_on_all_cloud_agents(m_cloud_agents, [](ICloudServiceAgent& cloud_agent) { return cloud_agent.refresh_connection(); });
else {
const auto cloud_agent = get_cloud_agent(provider);
if (cloud_agent)
return cloud_agent->refresh_connection();
return -1;
}
}
void NetworkAgent::enable_multi_machine(bool enable, const std::string& provider)