diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/common/wifi_native_define.h b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/common/wifi_native_define.h index acd3df36920dd641adee68f3bf7d5d0b97a25eca..9bbe516620020c0c0b213ee71c04616557eb6dd2 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/common/wifi_native_define.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/common/wifi_native_define.h @@ -126,6 +126,7 @@ typedef enum HalCallbackEvent { } HalCallbackEvent; typedef enum Wifi80211StatusCode { + WLAN_STATUS_EXT_DRIVER_FAIL = -1, WLAN_STATUS_UNSPECIFIED_FAILURE = 1, WLAN_STATUS_CHALLENGE_FAIL = 15, WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17, diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor.cpp index 55e9d1941401440db29e888030317151f9febbcc..4b434e7ed2491bd66c4a9ed9236412add2e2fc98 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_monitor.cpp @@ -29,6 +29,11 @@ DEFINE_WIFILOG_LABEL("StaMonitor"); namespace OHOS { namespace Wifi { constexpr const char* WPA_CSA_CHANNEL_SWITCH_FREQ_PREFIX = "freq="; +/* +if the reject is caused by driver fail, we need set a delay time to reconnect to reduce the probability of conflicts +between this connection and other vap associations (like scan or p2p_enhance) +*/ +const int32_t CONNECT_REJECT_DELAY_TIME_MS = 500; StaMonitor::StaMonitor(int instId) : pStaStateMachine(nullptr), m_instId(instId) { WIFI_LOGI("StaMonitor constuctor insId %{public}d", instId); @@ -264,7 +269,11 @@ void StaMonitor::OnWpaConnectionRejectCallBack(const AssocRejectInfo &assocRejec msg->AddStringMessageBody(assocRejectInfo.bssid); msg->SetParam1(assocRejectInfo.statusCode); msg->SetParam2(assocRejectInfo.timeOut); - pStaStateMachine->SendMessage(msg); + if (assocRejectInfo.statusCode == Wifi80211StatusCode::WLAN_STATUS_EXT_DRIVER_FAIL) { + pStaStateMachine->MessageExecutedLater(msg, CONNECT_REJECT_DELAY_TIME_MS); + } else { + pStaStateMachine->SendMessage(msg); + } } void StaMonitor::OnWpsPbcOverlapCallBack(int status)