Browse Source

!10313 调整ResourceWatcher网络探测方式
Merge pull request !10313 from 80310970/T24HB561_VideoCleanOptmize_0701

Gifur 1 năm trước cách đây
mục cha
commit
92ebef7d70
1 tập tin đã thay đổi với 6 bổ sung22 xóa
  1. 6 22
      Module/mod_ResourceWatcher/ResourceWatcherFSM.cpp

+ 6 - 22
Module/mod_ResourceWatcher/ResourceWatcherFSM.cpp

@@ -9,6 +9,7 @@
 #include <ctime>
 #include "CommEntityUtil.hpp"
 #include "SpUtility.h"
+#include "RestfulFunc.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include "ResourceWatcher_UserCode.h"
@@ -23,8 +24,6 @@
 #include "toolkit.h"
 #include "iniutil.h"
 #include "osutil.h"
-#include "SpUtility.h"
-#include "RestfulFunc.h"
 #else
 #include <intrin.h>
 #include <ShlObj.h>
@@ -429,17 +428,16 @@ void ResourceWatcherFSM::LinkDetect(int detectType, const char* url, bool& statu
     int flag = 0;
     unsigned int tInterval = 0;
 
-#if defined(RVC_OS_LINUX)
     string msg;
     if (tUrl.find("http") == string::npos) {
         tUrl = host + tUrl;
     }
     DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Check url:[%s].", tUrl.c_str());
-    timeval begin, end;
-    gettimeofday(&begin, NULL);
+    ULLINT begin, end;
+    begin = SP::Module::Comm::RVCGetTickCount();
     int curFlag = HttpProbe(tUrl, msg, 5);
-    gettimeofday(&end, NULL);
-    tInterval = (end.tv_sec - begin.tv_sec) * 1000 + (end.tv_usec - begin.tv_usec) / 1000;
+    end = SP::Module::Comm::RVCGetTickCount();
+    tInterval = end - begin;
 
     if (curFlag > 0 && curFlag < 400) {
         flag = true;
@@ -447,20 +445,6 @@ void ResourceWatcherFSM::LinkDetect(int detectType, const char* url, bool& statu
     else {
         flag = false;
     }
-#else
-    DWORD start, finish;
-    if (tUrl.find("http") == string::npos) {
-        tUrl = host + tUrl;
-    }
-    char tmpUrl[MAX_PATH] = { 0 };
-    strcpy_s(tmpUrl, tUrl.c_str());
-
-    start = timeGetTime();
-    flag = http_probe(tmpUrl, 5000, 0, warnFlag);
-    finish = timeGetTime();
-
-    tInterval = finish - start;
-#endif //RVC_OS_LINUX
 
     if (flag == false) {
         status = false;
@@ -469,7 +453,7 @@ void ResourceWatcherFSM::LinkDetect(int detectType, const char* url, bool& statu
         status = true;
     }
 
-    delay = tInterval;
+    delay = tInterval > 0 ? tInterval:1;
 }
 
 ErrorCodeEnum ResourceWatcherFSM::BizLinkDetect(