|
@@ -125,9 +125,10 @@ void CAccessAuthFSM::s2_on_entry()
|
|
|
LOG_FUNCTION();
|
|
|
|
|
|
m_finishAccess = 0;
|
|
|
- TimeOutTask* timeOutTask = new TimeOutTask(this,120 * 1000);// 设定30秒准入超时
|
|
|
+ TimeOutTask* timeOutTask = new TimeOutTask(this, 120 * 1000);
|
|
|
GetEntityBase()->GetFunction()->PostThreadPoolTask(timeOutTask);
|
|
|
Dbg("启动了准入超时定时器2分钟[%d]",m_finishAccess);
|
|
|
+ GetEntityBase()->GetFunction()->ShowStartupInfo("正在进行准入...");
|
|
|
|
|
|
auto pEntity = (CAccessAuthEntity*)m_pEntity;
|
|
|
|
|
@@ -136,8 +137,7 @@ void CAccessAuthFSM::s2_on_entry()
|
|
|
{
|
|
|
FSMEvent *pEvent = new FSMEvent(Event_UpdateWKFail);
|
|
|
PostEventFIFO(pEvent);
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_INIT_KMC,
|
|
|
- GetOutPutStr("%s%08X", "InitKMC", rc).c_str());
|
|
|
+ LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_INIT_KMC, GetOutPutStr("%s%08X", "InitKMC", rc).c_str());
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -160,9 +160,9 @@ void CAccessAuthFSM::s2_on_exit()
|
|
|
// 关闭连接
|
|
|
auto pEntity = (CAccessAuthEntity*)m_pEntity;
|
|
|
pEntity->ReleaseKMC();
|
|
|
-
|
|
|
SecureClientRelease();
|
|
|
CancelTimer(1);
|
|
|
+ GetEntityBase()->GetFunction()->ShowStartupInfo("");
|
|
|
}
|
|
|
|
|
|
// 会收到Event_UpdateWKResult和Event_ReqTokenResult和EVT_TIMER
|
|
@@ -200,20 +200,17 @@ unsigned int CAccessAuthFSM::s2_on_event(FSMEvent* pEvent)
|
|
|
auto pEntity = ((CAccessAuthEntity*)m_pEntity);
|
|
|
int isFirstAccessAfterSM = pEntity->GetOrSetIsFirstSM(0);
|
|
|
if (isFirstAccessAfterSM != 1) {
|
|
|
- Dbg("否则继续!");
|
|
|
- FSMEvent* pEvent = new FSMEvent(Event_CheckMD5Succ);
|
|
|
- PostEventFIFO(pEvent);
|
|
|
+ Dbg("非首次准入");
|
|
|
+ PostEventFIFO(new FSMEvent(Event_CheckMD5Succ));
|
|
|
return 0;
|
|
|
}
|
|
|
- Dbg("等待自动初始化完成!");
|
|
|
+ Dbg("第一次准入 !!!");
|
|
|
CSimpleStringA strInitState;
|
|
|
pEntity->GetFunction()->GetSysVar("InitState", strInitState);
|
|
|
if (strInitState == "1") {
|
|
|
- //2020/5/29 删除了各个文件MD5检验的代码
|
|
|
- FSMEvent* pEvent = new FSMEvent(Event_CheckMD5Succ);
|
|
|
- PostEventFIFO(pEvent);
|
|
|
- }
|
|
|
- else {
|
|
|
+ //2020/5/29 删除了各个文件MD5检验的代码
|
|
|
+ PostEventFIFO(new FSMEvent(Event_CheckMD5Succ));
|
|
|
+ } else {
|
|
|
ScheduleTimer(3, 1500);
|
|
|
}
|
|
|
}
|
|
@@ -229,8 +226,7 @@ unsigned int CAccessAuthFSM::s2_on_event(FSMEvent* pEvent)
|
|
|
DWORD rc = m_pConnection->SendSyncTimePackage();
|
|
|
if (rc != Error_Succeed)
|
|
|
{
|
|
|
- FSMEvent *pEvent = new FSMEvent(Event_EndSyncTime);
|
|
|
- PostEventFIFO(pEvent);
|
|
|
+ PostEventFIFO(new FSMEvent(Event_EndSyncTime));
|
|
|
LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_SYNC_TIME,
|
|
|
GetOutPutStr("%s%08X", "SendSyncTimePackage", rc).c_str());
|
|
|
}
|
|
@@ -260,6 +256,7 @@ unsigned int CAccessAuthFSM::s2_on_event(FSMEvent* pEvent)
|
|
|
|
|
|
CSimpleStringA strWKSyncSuccTime = "";
|
|
|
CSimpleStringA strWKSyncFailCount = "";
|
|
|
+
|
|
|
#ifdef RVC_OS_WIN
|
|
|
auto rc = pEntity->GetFunction()->GetSysVar("WKSyncSuccTime", strWKSyncSuccTime);
|
|
|
assert(rc == Error_Succeed);
|
|
@@ -278,13 +275,16 @@ unsigned int CAccessAuthFSM::s2_on_event(FSMEvent* pEvent)
|
|
|
if (nWKLastSyncTime > 0 && stSyncTime.wYear == stNow.wYear
|
|
|
&& stSyncTime.wMonth == stNow.wMonth && stSyncTime.wDay == stNow.wDay
|
|
|
&& nWKSyncFailCount == 0 ) // 最近一次同步成功,才能跳过
|
|
|
+
|
|
|
#else
|
|
|
- Dbg("获取WKSyncSuccTime。。。");
|
|
|
- auto rc = pEntity->GetFunction()->GetSysVar("WKSyncSuccTime", strWKSyncSuccTime);
|
|
|
- if (rc != Error_Succeed) Dbg("获取WKSyncSuccTime失败");
|
|
|
|
|
|
+ Dbg("获取 WKSyncSuccTime");
|
|
|
+ auto rc = pEntity->GetFunction()->GetSysVar("WKSyncSuccTime", strWKSyncSuccTime);
|
|
|
+ if (rc != Error_Succeed)
|
|
|
+ Dbg("获取WKSyncSuccTime失败");
|
|
|
rc = pEntity->GetFunction()->GetSysVar("WKSyncFailCount", strWKSyncFailCount);
|
|
|
- if (rc != Error_Succeed) Dbg("获取WKSyncFailCount失败");
|
|
|
+ if (rc != Error_Succeed)
|
|
|
+ Dbg("获取WKSyncFailCount失败");
|
|
|
|
|
|
Dbg("strWKSyncSuccTime=%s", strWKSyncSuccTime.GetData());
|
|
|
Dbg("strWKSyncFailCount=%s", strWKSyncFailCount.GetData());
|
|
@@ -308,7 +308,6 @@ unsigned int CAccessAuthFSM::s2_on_event(FSMEvent* pEvent)
|
|
|
&& nWKSyncFailCount == 0) // 最近一次同步成功,才能跳过
|
|
|
#endif
|
|
|
|
|
|
-
|
|
|
{
|
|
|
Dbg("WK has been updated today");
|
|
|
FSMEvent *pEvent = new FSMEvent(Event_IgnoreUpdateWK);
|
|
@@ -317,9 +316,7 @@ unsigned int CAccessAuthFSM::s2_on_event(FSMEvent* pEvent)
|
|
|
else
|
|
|
{
|
|
|
Dbg("begin update WK now");
|
|
|
-
|
|
|
- // 请求WK
|
|
|
- DWORD rc = m_pConnection->SendWKUpdatePackage();
|
|
|
+ DWORD rc = m_pConnection->SendWKUpdatePackage(); // 请求WK
|
|
|
if (rc != Error_Succeed)
|
|
|
{
|
|
|
LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_UPDATE_WK,
|
|
@@ -328,8 +325,7 @@ unsigned int CAccessAuthFSM::s2_on_event(FSMEvent* pEvent)
|
|
|
PostEventFIFO(pEvent);
|
|
|
}
|
|
|
}
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
-#else
|
|
|
+#if defined(RVC_OS_LINUX)
|
|
|
if(lastTime != NULL) delete lastTime;
|
|
|
if(currentTime != NULL) delete currentTime;
|
|
|
#endif
|
|
@@ -611,7 +607,7 @@ DWORD CAccessAuthFSM::InitDevice(SpReqAnsContext<AccessAuthService_InitDev_Req,
|
|
|
|
|
|
if (rc != Error_Succeed)
|
|
|
{
|
|
|
- ctx->Answer(rc? Error_Unexpect: Error_Succeed);
|
|
|
+ ctx->Answer(rc? Error_Unexpect: Error_Succeed); //???
|
|
|
return rc;
|
|
|
}
|
|
|
|