Prechádzať zdrojové kódy

Z991239-4916 #comment 配置格式有误时 的异常处理

oilyang 1 rok pred
rodič
commit
ddb926aebd
1 zmenil súbory, kde vykonal 11 pridanie a 7 odobranie
  1. 11 7
      Module/mod_vtmloader/VtmLoaderFSM.cpp

+ 11 - 7
Module/mod_vtmloader/VtmLoaderFSM.cpp

@@ -858,18 +858,20 @@ int CVtmLoaderFSM::NetWorkCheckAndGetSetting()
 	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to check network status");
 	CSimpleStringA strMsg(true),tmpTS("X");
 	//GetEntityBase()->GetFunction()->GetSysVar("TerminalStage", tmpTS);
+	int netcheckCount = 1;
 	while (true)
 	{
 		if (!DetectNetworkLegality(strMsg)) {
 			//LogWarn(Severity_High, Error_Unexpect, VtmLoader_UserCode_NetCard_UnAvaible, strMsg.GetData());
 			LogWarn(Severity_High, Error_Unexpect, VtmLoader_BootInfoPrint, strMsg.GetData());
-			LogWarn(Severity_Low, Error_Unexpect, VtmLoader_BootInfoPrint, CSimpleStringA::Format("%d 秒后自动重试。请确认终端到总行服务网络是否正常", m_iDetectInterval/1000));
+			LogWarn(Severity_Low, Error_Unexpect, VtmLoader_BootInfoPrint, CSimpleStringA::Format("%d 秒后自动重试(第%d次重试)。请检查网线是否插好、网络是否正常", m_iDetectInterval/1000, netcheckCount));
 			//if (tmpTS.Compare("E") != 0)
 			//{
 			//	GetEntityBase()->GetFunction()->SetSysVar("TerminalStage", "E");
 			//	tmpTS = "E";
 			//}
 			Sleep(5000);
+			netcheckCount++;
 		}
 		else
 		{
@@ -956,7 +958,7 @@ int CVtmLoaderFSM::EntityLoad()
 		CAutoArray<CSimpleStringA> arrEntity;
 		arrEntity.Init(2);
 		arrEntity = arrCoreBoot[i].Split('=');
-		if (arrEntity.GetCount() <= 0)
+		if (arrEntity.GetCount() < 2)
 			break;
 		if (arrEntity[0].Compare("VtmLoader", true) == 0 || arrEntity[0].Compare("Chromium", true) == 0
 			|| arrEntity[0].Compare("GuiConsole", true) == 0)
@@ -980,7 +982,7 @@ int CVtmLoaderFSM::EntityLoad()
 		CAutoArray<CSimpleStringA> arrEntity;
 		arrEntity.Init(2);
 		arrEntity = arrSafeLoad[i].Split('=');
-		if (arrEntity.GetCount() <= 0)
+		if (arrEntity.GetCount() < 2)
 			break;
 		if (arrEntity[0].Compare("VtmLoader", true) == 0 || arrEntity[0].Compare("Chromium", true) == 0
 			|| arrEntity[0].Compare("GuiConsole", true) == 0)
@@ -1007,7 +1009,7 @@ int CVtmLoaderFSM::EntityLoad()
 		CAutoArray<CSimpleStringA> arrEntity;
 		arrEntity.Init(2);
 		arrEntity = arrOperating[i].Split('=');
-		if (arrEntity.GetCount() <= 0)
+		if (arrEntity.GetCount() < 2)
 			break;
 		if (arrEntity[0].Compare("VtmLoader", true) == 0 || arrEntity[0].Compare("Chromium", true) == 0
 			|| arrEntity[0].Compare("GuiConsole", true) == 0)
@@ -1465,12 +1467,14 @@ ErrorCodeEnum CVtmLoaderFSM::SubscribeEntitysEvents()
 int CVtmLoaderFSM::HttpConnCheck(CSimpleStringA csHttAddr, HttpAddrType eType)
 {
 	ULLINT beginTick = SP::Module::Comm::RVCGetTickCount();
+	int httpcheckCount = 1;
 	while(true){
 		if (!checkHttpActive(csHttAddr.GetData()))
 		{
-			LogWarn(Severity_Middle, Error_Unexpect, VtmLoader_BootInfoPrint, CSimpleStringA::Format("尝试连接总行服务失败(%s),%d 秒后自动重试。请确认终端到总行服务网络是否正常", csHttAddr.GetData(), m_iDetectInterval/1000));
+			LogWarn(Severity_Middle, Error_Unexpect, VtmLoader_BootInfoPrint, CSimpleStringA::Format("尝试连接总行服务失败(%s),%d 秒后自动重试(第%d次重试)。请确认终端到总行服务网络是否正常", csHttAddr.GetData(), m_iDetectInterval/1000, httpcheckCount));
 			m_httpCheckResult[eType] = HttpConnResult_Failed;
 			Sleep(m_iDetectInterval);
+			httpcheckCount++;
 			NetworkAddressesList interNames;
 			NetworkAddressesList macAddrs;
 			NetworkAddressesList ipAddrs;
@@ -1488,8 +1492,8 @@ int CVtmLoaderFSM::HttpConnCheck(CSimpleStringA csHttAddr, HttpAddrType eType)
 			m_httpCheckResult[eType] = HttpConnResult_OK;
 			if ((SP::Module::Comm::RVCGetTickCount() - beginTick) > 3000)
 			{
-				LogWarn(Severity_Low, Error_Unexpect, VtmLoader_BootInfoPrint, CSimpleStringA::Format("尝试连接总行服务成功(%s),但是网络偏慢,连接花了(%d)秒,请检查网络!"
-					, csHttAddr.GetData(), (SP::Module::Comm::RVCGetTickCount() - beginTick)/1000));
+				LogWarn(Severity_Low, Error_Unexpect, VtmLoader_BootInfoPrint, CSimpleStringA::Format("第(%d)次尝试连接总行服务成功(%s),但是网络偏慢,连接花了(%d)秒,请检查网络!"
+					, httpcheckCount, csHttAddr.GetData(), (SP::Module::Comm::RVCGetTickCount() - beginTick)/1000));
 			}
 			LogWarn(Severity_Low, Error_Succeed, VtmLoader_BootInfoPrint, CSimpleStringA::Format("尝试连接总行服务成功(%s)", csHttAddr.GetData()));
 			return 0;