limit selfcure time

Signed-off-by: yiyajun <yiyajun@huawei.com>
This commit is contained in:
yiyajun 2024-11-19 16:23:37 +08:00
parent 80b3c85208
commit 3baee628cb
2 changed files with 7 additions and 3 deletions

View File

@ -529,11 +529,11 @@ void SelfCureStateMachine::ConnectedMonitorState::HandleDnsFailedMonitor(Interna
void SelfCureStateMachine::ConnectedMonitorState::HandleInternetFailedDetected(InternalMessagePtr msg)
{
WIFI_LOGD("HandleInternetFailedDetected, wifi has no internet when connected.");
if (pSelfCureStateMachine->IsCustNetworkSelfCure()) {
WIFI_LOGI("current network do not need selfcure");
if (pSelfCureStateMachine->IsCustNetworkSelfCure() || pSelfCureStateMachine->isInternetFailureDetected_) {
WIFI_LOGI("do not need selfcure, %{public}d", pSelfCureStateMachine->isInternetFailureDetected_);
return;
}
pSelfCureStateMachine->isInternetFailureDetected_ = true;
if (!pSelfCureStateMachine->IsSuppOnCompletedState()) {
WIFI_LOGI("%{public}s: Wifi connection not completed", __FUNCTION__);
return;
@ -630,6 +630,7 @@ void SelfCureStateMachine::DisconnectedMonitorState::GoInState()
pSelfCureStateMachine->noAutoConnCounter = 0;
pSelfCureStateMachine->noAutoConnReason = -1;
pSelfCureStateMachine->connectedTime = 0;
pSelfCureStateMachine->isInternetFailureDetected_ = false;
pSelfCureStateMachine->ClearDhcpOffer();
return;
}
@ -964,6 +965,7 @@ void SelfCureStateMachine::InternetSelfCureState::HandleInternetRecoveryConfirm(
pSelfCureStateMachine->UpdateSelfCureConnectHistoryInfo(selfCureHistoryInfo, currentSelfCureLevel, true);
bool success = ConfirmInternetSelfCure(currentSelfCureLevel);
if (success) {
pSelfCureStateMachine->isInternetFailureDetected_ = false;
currentSelfCureLevel = WIFI_CURE_RESET_LEVEL_IDLE;
selfCureFailedCounter = 0;
hasInternetRecently = true;
@ -3535,6 +3537,7 @@ void SelfCureStateMachine::ResetSelfCureParam()
{
selfCureNetworkLastState_ = DetailedState::IDLE;
selfCureWifiLastState_ = WifiState::UNKNOWN;
selfCureState_ = SelfCureState::SCE_WIFI_INVALID_STATE;
connectNetworkRetryCnt = 0;
WifiConfigCenter::GetInstance().SetWifiSelfcureReset(false);
StopTimer(WIFI_CURE_RESET_OFF_TIMEOUT);

View File

@ -474,6 +474,7 @@ private:
sptr<NetStateObserver> mNetWorkDetect;
bool m_httpDetectResponse = false;
bool p2pEnhanceConnected_ = false;
bool isInternetFailureDetected_ = false;
DetailedState selfCureNetworkLastState_ = DetailedState::IDLE;
WifiState selfCureWifiLastState_ = WifiState::UNKNOWN;
SelfCureState selfCureState_ = SelfCureState::SCE_WIFI_INVALID_STATE;