|
@@ -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(
|