|
|
@@ -21,7 +21,7 @@
|
|
|
#endif
|
|
|
|
|
|
CAccessAuthFSM::CAccessAuthFSM()
|
|
|
- :m_pConnection(NULL),m_bAccessACS(false)
|
|
|
+ :m_pConnection(NULL),m_bAccessACS(false), m_fNetworkChecking(false)
|
|
|
{
|
|
|
m_nAccessFailedCount = 0;
|
|
|
}
|
|
|
@@ -1136,6 +1136,32 @@ struct TerminalExitTask :public ITaskSp {
|
|
|
#endif //WITH_CPPRESTSDK
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+struct NetworkCheckTask :public ITaskSp
|
|
|
+{
|
|
|
+ CAccessAuthFSM* m_fsm;
|
|
|
+ NetworkCheckTask(CAccessAuthFSM* fsm) :m_fsm(fsm) {
|
|
|
+ m_fsm->SetNetworkCheckingState();
|
|
|
+ }
|
|
|
+ ~NetworkCheckTask() {
|
|
|
+ m_fsm->SetNetworkCheckingState(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ void Process()
|
|
|
+ {
|
|
|
+ // CSimpleStringA strMsg(true);
|
|
|
+ FSMEvent* pEvt = new FSMEvent(CAccessAuthFSM::Event_NetworkIllegal);
|
|
|
+ pEvt->param1 = pEvt->param2 = 0;
|
|
|
+ if (!m_fsm->DetectNetworkLegality()) {
|
|
|
+ auto pAccessAuth = dynamic_cast<CAccessAuthEntity*>(m_fsm->GetEntityBase());
|
|
|
+ pAccessAuth->SetAuthErrMsg("终端上网方式不符合规范要求");
|
|
|
+ pEvt->param1 = 1;
|
|
|
+ }
|
|
|
+ m_fsm->PostEventFIFO(pEvt);
|
|
|
+ }
|
|
|
+
|
|
|
+};
|
|
|
+
|
|
|
void CAccessAuthFSM::doWarnMsg(int errReason, std::string errMsg, bool bNeedEvent, string varMsg) {
|
|
|
auto reasonStr = CSimpleString::Format("0x%X", errReason);
|
|
|
const std::string errMsgStr = SP::Utility::GBK2UTF8(errMsg);
|
|
|
@@ -1252,16 +1278,24 @@ void CAccessAuthFSM::s2_on_entry()
|
|
|
//}
|
|
|
//PostEventFIFO(new FSMEvent(Event_ConnectionOK));
|
|
|
|
|
|
+
|
|
|
+ LOG_FUNCTION();
|
|
|
+
|
|
|
+ m_finishAccess = 0;
|
|
|
+ SetEntryPermitSysVar("C");
|
|
|
+
|
|
|
+ CSmartPointer<NetworkCheckTask> networkCheck = new NetworkCheckTask(this);
|
|
|
+ GetEntityBase()->GetFunction()->PostThreadPoolTask(networkCheck.GetRawPointer());
|
|
|
}
|
|
|
|
|
|
void CAccessAuthFSM::s2_on_exit()
|
|
|
{
|
|
|
- // 关闭连接
|
|
|
- auto pEntity = (CAccessAuthEntity*)m_pEntity;
|
|
|
- pEntity->ReleaseKMC();
|
|
|
- SecureClientRelease();
|
|
|
- CancelTimer(1);
|
|
|
- GetEntityBase()->GetFunction()->ShowStartupInfo("");
|
|
|
+ //// 关闭连接
|
|
|
+ //auto pEntity = (CAccessAuthEntity*)m_pEntity;
|
|
|
+ //pEntity->ReleaseKMC();
|
|
|
+ //SecureClientRelease();
|
|
|
+ //CancelTimer(1);
|
|
|
+ //GetEntityBase()->GetFunction()->ShowStartupInfo("");
|
|
|
}
|
|
|
|
|
|
// 会收到Event_UpdateWKResult和Event_ReqTokenResult和EVT_TIMER
|