|
@@ -58,9 +58,11 @@ using namespace std;
|
|
|
|
|
|
const DWORD HEALTHMANAGER_TIMER_ID = 1;
|
|
|
const DWORD HEALTHMANAGER_WAIT_MAINPAGE_OPEN_TIMER_ID = 2;
|
|
|
+const DWORD HEALTHMANAGER_SELFCHECK_TIMER_ID = 3;
|
|
|
const DWORD HEALTHMANAGER_TIMER_INTERVAL = 60000;
|
|
|
const DWORD HEALTHMANAGER_WAIT_MAINPAGE_OPEN_TIMER_INTERVAL = 60000;
|
|
|
const DWORD HEALTHMANAGER_TIMER_INTERVAL_MINUTE = (HEALTHMANAGER_TIMER_INTERVAL/60000)*3;
|
|
|
+const DWORD HEALTHMANAGER_SELFCHECK_TIMER_INTERVAL = 60000;
|
|
|
|
|
|
#define WORKING_BUFFER_SIZE 15000
|
|
|
#define MAX_TRIES 3
|
|
@@ -142,10 +144,6 @@ void HealthManagerSession::Handle_DoEvent(SpReqAnsContext<HealthManagerService_D
|
|
|
DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
m_pEntity->DoEvent(ctx);
|
|
|
}
|
|
|
-void HealthManagerSession::Handle_GetEntityCfgInfo(SpReqAnsContext<HealthManagerService_GetEntityCfgInfo_Req, HealthManagerService_GetEntityCfgInfo_Ans>::Pointer ctx)
|
|
|
-{
|
|
|
- ctx->Answer(Error_NotImpl);
|
|
|
-}
|
|
|
void HealthManagerSession::Handle_GetNetworkState(SpReqAnsContext<HealthManagerService_GetNetworkState_Req, HealthManagerService_GetNetworkState_Ans>::Pointer ctx)
|
|
|
{
|
|
|
DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
@@ -180,33 +178,11 @@ void HealthManagerSession::Handle_ControlEntityLife(SpReqAnsContext<HealthManage
|
|
|
DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
m_pEntity->ControlEntityLife(ctx);
|
|
|
}
|
|
|
-
|
|
|
-//通过当前实施步骤判断当前为第几次的临时重启
|
|
|
-static inline int GetDeployStepFromStatus(int status)
|
|
|
+void HealthManagerSession::Handle_RealCheck(SpReqAnsContext<HealthManagerService_RealCheck_Req, HealthManagerService_RealCheck_Ans>::Pointer ctx)
|
|
|
{
|
|
|
- int result(-1);
|
|
|
-
|
|
|
- switch (status) {
|
|
|
- case DeployStep_Begin:
|
|
|
- case DeployStep_3rdParty_FontInstall:
|
|
|
- case DeployStep_3rdParty_SogouInstall:
|
|
|
- case DeployStep_GetTerminalInfo:
|
|
|
- result = 0;
|
|
|
- break;
|
|
|
- case DeployStep_AdapterConfig:
|
|
|
- result = 1;
|
|
|
- break;
|
|
|
- case DeployStep_MediaConfig:
|
|
|
- case DeployStep_FetchCenterSettings:
|
|
|
- case DeployStep_AccessAuthorize:
|
|
|
- result = 2;
|
|
|
- break;
|
|
|
- default:
|
|
|
- result = 0;
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- return result;
|
|
|
+ LOG_FUNCTION();
|
|
|
+ DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
+ m_pEntity->RealCheck(ctx);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1509,6 +1485,8 @@ void CHealthManagerEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nL
|
|
|
WarnPromptTask* task = new WarnPromptTask(this); //通过工作线程弹窗并告警
|
|
|
GetFunction()->PostThreadPoolTask(task);
|
|
|
}
|
|
|
+ ITimerListener* pListener = new TimerOutHelper<CHealthManagerEntity>(this, &CHealthManagerEntity::OnSelfCheckTimeout);
|
|
|
+ GetFunction()->SetTimer(HEALTHMANAGER_SELFCHECK_TIMER_ID, pListener, HEALTHMANAGER_SELFCHECK_TIMER_INTERVAL);
|
|
|
|
|
|
break;
|
|
|
} //oilyang@20210331 distinguish reasons of accessauth failed to decide what to do next
|
|
@@ -1980,6 +1958,29 @@ void CHealthManagerEntity::ToCalcRebootHourAndMinute(int restartBegin, int resta
|
|
|
m_restartMinute = minutes - (m_restartHour - 1) * 60;
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("restartBegin:%d, restartEnd:%d, xTerm:%d, minutes:%d, m_restartHour:%d, m_restartMinute:%d", restartBegin, restartEnd, xTerm, minutes, m_restartHour, m_restartMinute);
|
|
|
}
|
|
|
+void CHealthManagerEntity::RealCheck(SpReqAnsContext<HealthManagerService_RealCheck_Req, HealthManagerService_RealCheck_Ans>::Pointer ctx)
|
|
|
+{
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Real check %s", (LPCTSTR)ctx->Req.name);
|
|
|
+ m_fsm.CheckEntity(ctx->Req.name, Test_ShakeHand, false);
|
|
|
+ ctx->Answer(Error_Succeed);
|
|
|
+}
|
|
|
+void CHealthManagerEntity::OnSelfCheckTimeout()
|
|
|
+{
|
|
|
+ CSmartPointer<IEntityFunction> pFunc = GetFunction();
|
|
|
+ CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
|
|
|
+ CSmartPointer<IAsynWaitSp> spWait;
|
|
|
+ ErrorCodeEnum errCode;
|
|
|
+ int activeEnCount = m_activeEntity.GetCount();
|
|
|
+
|
|
|
+ for (int i = 0; i < activeEnCount; ++i)
|
|
|
+ {
|
|
|
+ //invalid or "HealthManager" itself,no need to check
|
|
|
+ if (m_activeEntity[i].IsNullOrEmpty() || m_activeEntity[i].Compare(GetEntityName()) == 0)
|
|
|
+ continue;
|
|
|
+ m_fsm.CheckEntity(m_activeEntity[i].GetData(), Test_ShakeHand);//oiltmp move to entity?
|
|
|
+ }
|
|
|
+ GetFunction()->ResetTimer(HEALTHMANAGER_SELFCHECK_TIMER_ID, HEALTHMANAGER_SELFCHECK_TIMER_INTERVAL);
|
|
|
+}
|
|
|
SP_BEGIN_ENTITY_MAP()
|
|
|
SP_ENTITY(CHealthManagerEntity)
|
|
|
SP_END_ENTITY_MAP()
|