mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
ENH: remove check link state
Change-Id: Iba16694299f92a89e63ea9c4829e3087a29bade1 Signed-off-by: Stone Li <stone.li@bambulab.com> (cherry picked from commit f8ccd60bdb7489d325e457948e27c5d854089e08)
This commit is contained in:
parent
91f3c7bd1b
commit
d603315d72
2 changed files with 0 additions and 81 deletions
|
@ -2770,9 +2770,6 @@ bool GUI_App::on_init_inner()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "start_check_network_state...";
|
|
||||||
start_check_network_state();
|
|
||||||
|
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
|
|
||||||
flush_logs();
|
flush_logs();
|
||||||
|
@ -4134,81 +4131,6 @@ void GUI_App::on_user_login_handle(wxCommandEvent &evt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI_App::start_check_network_state()
|
|
||||||
{
|
|
||||||
boost::thread* test_microsoft = new boost::thread([this] {
|
|
||||||
start_test_url("www.microsoft.com");
|
|
||||||
});
|
|
||||||
boost::thread* test_apple = new boost::thread([this] {
|
|
||||||
start_test_url("www.apple.com");
|
|
||||||
});
|
|
||||||
boost::thread* test_amazon = new boost::thread([this] {
|
|
||||||
start_test_url("www.amazon.com");
|
|
||||||
});
|
|
||||||
|
|
||||||
m_check_network_thread = boost::thread([this] {
|
|
||||||
int sec_count = 1;
|
|
||||||
while (!m_is_closing) {
|
|
||||||
if (sec_count % 10 == 0) {
|
|
||||||
bool link_result = check_network_state();
|
|
||||||
if (!link_result) {
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "link_result = " << link_result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(1000));
|
|
||||||
sec_count++;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GUI_App::check_network_state()
|
|
||||||
{
|
|
||||||
bool result = false;
|
|
||||||
for (auto link : test_url_state) {
|
|
||||||
result = result | link.second;
|
|
||||||
}
|
|
||||||
if (m_agent) {
|
|
||||||
if (result)
|
|
||||||
m_agent->track_update_property("link_state", "1");
|
|
||||||
else
|
|
||||||
m_agent->track_update_property("link_state", "0");
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GUI_App::start_test_url(std::string url)
|
|
||||||
{
|
|
||||||
int sec_count = 0;
|
|
||||||
while (!m_is_closing) {
|
|
||||||
if (sec_count % 10 == 0) {
|
|
||||||
Slic3r::Http http = Slic3r::Http::get(url);
|
|
||||||
int result = -1;
|
|
||||||
http.timeout_max(5)
|
|
||||||
.on_complete([&result](std::string body, unsigned status) {
|
|
||||||
try {
|
|
||||||
if (status == 200) {
|
|
||||||
result = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (...) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.on_error([](std::string body, std::string error, unsigned int status) {
|
|
||||||
;
|
|
||||||
}).perform_sync();
|
|
||||||
|
|
||||||
if (result == 0) {
|
|
||||||
test_url_state[url] = true;
|
|
||||||
} else {
|
|
||||||
test_url_state[url] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(1000));
|
|
||||||
sec_count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GUI_App::check_track_enable()
|
void GUI_App::check_track_enable()
|
||||||
{
|
{
|
||||||
|
|
|
@ -430,9 +430,6 @@ public:
|
||||||
void on_set_selected_machine(wxCommandEvent& evt);
|
void on_set_selected_machine(wxCommandEvent& evt);
|
||||||
void on_user_login(wxCommandEvent &evt);
|
void on_user_login(wxCommandEvent &evt);
|
||||||
void on_user_login_handle(wxCommandEvent& evt);
|
void on_user_login_handle(wxCommandEvent& evt);
|
||||||
void start_check_network_state();
|
|
||||||
bool check_network_state();
|
|
||||||
void start_test_url(std::string url);
|
|
||||||
void enable_user_preset_folder(bool enable);
|
void enable_user_preset_folder(bool enable);
|
||||||
|
|
||||||
// BBS
|
// BBS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue