|
@@ -90,7 +90,7 @@ void web_beatheart_thread()
|
|
{
|
|
{
|
|
while (true)
|
|
while (true)
|
|
{
|
|
{
|
|
- std::this_thread::sleep_for(std::chrono::seconds(5));
|
|
|
|
|
|
+ std::this_thread::sleep_for(std::chrono::seconds(3));
|
|
if(beatheart_count==0)//一次都没收到web的心跳信号
|
|
if(beatheart_count==0)//一次都没收到web的心跳信号
|
|
{
|
|
{
|
|
log_info("没有收到web心跳信号");
|
|
log_info("没有收到web心跳信号");
|
|
@@ -106,28 +106,24 @@ void web_beatheart_thread()
|
|
|
|
|
|
beatheart_count=0;
|
|
beatheart_count=0;
|
|
|
|
|
|
- web_close();
|
|
|
|
- std::this_thread::sleep_for(std::chrono::seconds(10));
|
|
|
|
- log_error("web连接异常中断, 开始重连web(第一次)");
|
|
|
|
- if(web_connect())
|
|
|
|
|
|
+ int count=0;
|
|
|
|
+ while (true)
|
|
{
|
|
{
|
|
- log_info("重连web ok");
|
|
|
|
- std::this_thread::sleep_for(std::chrono::seconds(10));
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- web_close();
|
|
|
|
- std::this_thread::sleep_for(std::chrono::seconds(60));
|
|
|
|
- log_error("web连接异常中断, 开始重连web(第二次)");
|
|
|
|
- if(web_connect())
|
|
|
|
- {
|
|
|
|
- log_info("重连web ok");
|
|
|
|
- std::this_thread::sleep_for(std::chrono::seconds(10));
|
|
|
|
- continue;
|
|
|
|
|
|
+ count++;
|
|
|
|
+ if(count>=10000)
|
|
|
|
+ {
|
|
|
|
+ count=10000;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ web_close();
|
|
|
|
+ log_error("web连接异常中断, 开始重连web(第%d次)", count);
|
|
|
|
+ std::this_thread::sleep_for(std::chrono::seconds(2));
|
|
|
|
+ if(web_connect())
|
|
|
|
+ {
|
|
|
|
+ log_info("重连web ok");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
- log_error("web连接异常中断, 重连web失败,关闭采集主程序");
|
|
|
|
- exit(0);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|