ENH:optimized the retry of requests

jira:[for network optimized]

Change-Id: Iea43f4a97c7cd568171287278a07689e954d1093
(cherry picked from commit 35d3de8abe63a0cba30948581ed26a8bc7f94162)
(cherry picked from commit 30bad38fb979f5c5a10e4b869ec2e41fa99857f8)
This commit is contained in:
tao wang 2024-09-16 22:29:39 +08:00 committed by Noisyfox
parent 569d4e6307
commit 8bb7ea7cfc
7 changed files with 156 additions and 2 deletions

View file

@ -76,6 +76,7 @@ func_build_login_info NetworkAgent::build_login_info_ptr = nullptr
func_get_model_id_from_desgin_id NetworkAgent::get_model_id_from_desgin_id_ptr = nullptr;
func_ping_bind NetworkAgent::ping_bind_ptr = nullptr;
func_bind_detect NetworkAgent::bind_detect_ptr = nullptr;
func_set_server_callback NetworkAgent::set_server_callback_ptr = nullptr;
func_bind NetworkAgent::bind_ptr = nullptr;
func_unbind NetworkAgent::unbind_ptr = nullptr;
func_get_bambulab_host NetworkAgent::get_bambulab_host_ptr = nullptr;
@ -286,6 +287,7 @@ int NetworkAgent::initialize_network_module(bool using_backup)
build_login_info_ptr = reinterpret_cast<func_build_login_info>(get_network_function("bambu_network_build_login_info"));
ping_bind_ptr = reinterpret_cast<func_ping_bind>(get_network_function("bambu_network_ping_bind"));
bind_detect_ptr = reinterpret_cast<func_bind_detect>(get_network_function("bambu_network_bind_detect"));
set_server_callback_ptr = reinterpret_cast<func_set_server_callback>(get_network_function("bambu_network_set_server_callback"));
get_model_id_from_desgin_id_ptr = reinterpret_cast<func_get_model_id_from_desgin_id>(get_network_function("bambu_network_get_model_id_from_desgin_id"));
bind_ptr = reinterpret_cast<func_bind>(get_network_function("bambu_network_bind"));
unbind_ptr = reinterpret_cast<func_unbind>(get_network_function("bambu_network_unbind"));
@ -1037,6 +1039,18 @@ int NetworkAgent::bind_detect(std::string dev_ip, std::string sec_link, detectRe
return ret;
}
int NetworkAgent::set_server_callback(OnServerErrFn fn)
{
int ret = 0;
if (network_agent && set_server_callback_ptr) {
ret = set_server_callback_ptr(network_agent, fn);
if (ret)
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%")
% network_agent % ret;
}
return ret;
}
int NetworkAgent::bind(std::string dev_ip, std::string dev_id, std::string sec_link, std::string timezone, bool improved, OnUpdateStatusFn update_fn)
{
int ret = 0;