diff options
author | Jimmy Chen <jimmycmchen@google.com> | 2019-03-19 15:43:26 +0800 |
---|---|---|
committer | Jimmy Chen <jimmycmchen@google.com> | 2019-03-19 16:58:14 +0800 |
commit | 0104ef37185e90c4e586c0700aa4e3e24fe8a053 (patch) | |
tree | 2bc0652c9672f9024a37bf9fc74ff21736aa22e6 | |
parent | 8b0b5ed2aaa7e8572c4d30b3f66e34bd136e444d (diff) | |
download | wpa_supplicant_8-0104ef37185e90c4e586c0700aa4e3e24fe8a053.tar.gz |
p2p: finetune group join scan process
Sometimes scan might be occupied by WiFi, we just need to fire the scan
later but not abort the whole connecting.
No need to check scan res handler since we can also use previous scan
results with updated request.
Bug: 125390567
Test: manually test with FileGo
Change-Id: I31a99dfa6c9860d95f25a2b3c8ab8d91e64ffbde
-rw-r--r-- | wpa_supplicant/hidl/1.2/p2p_iface.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/wpa_supplicant/hidl/1.2/p2p_iface.cpp b/wpa_supplicant/hidl/1.2/p2p_iface.cpp index dba66646..bcd96c39 100644 --- a/wpa_supplicant/hidl/1.2/p2p_iface.cpp +++ b/wpa_supplicant/hidl/1.2/p2p_iface.cpp @@ -1675,21 +1675,22 @@ SupplicantStatus P2pIface::addGroup_1_2Internal( wpa_printf(MSG_INFO, "No matched BSS exists, try to find it by scan"); - if (wpa_s->scan_res_handler) { - wpa_printf(MSG_WARNING, "There is on-going scanning, cannot start another scan."); - return {SupplicantStatusCode::FAILURE_UNKNOWN, - "Failed to start scan due to device busy."}; - } - if (pending_scan_res_join_callback != NULL) { - wpa_printf(MSG_WARNING, "There is running group join scan."); - return {SupplicantStatusCode::FAILURE_UNKNOWN, - "Failed to start scan due to device busy."}; + wpa_printf(MSG_WARNING, "P2P: Renew scan result callback with new request."); } pending_join_scan_callback = [wpa_s, ssid, freq]() { - if (0 != joinScanReq(wpa_s, ssid, freq)) { + int ret = joinScanReq(wpa_s, ssid, freq); + // for BUSY case, the scan might be occupied by WiFi. + // Do not give up immediately, but try again later. + if (-EBUSY == ret) { + // re-schedule this join scan and don't consume retry count. + if (pending_scan_res_join_callback) { + wpa_s->p2p_join_scan_count--; + pending_scan_res_join_callback(); + } + } else if (0 != ret) { notifyGroupJoinFailure(wpa_s); pending_scan_res_join_callback = NULL; } @@ -1732,8 +1733,8 @@ SupplicantStatus P2pIface::addGroup_1_2Internal( }; wpa_s->p2p_join_scan_count = 0; - if (0 != joinScanReq(wpa_s, ssid, freq)) { - pending_scan_res_join_callback = NULL; + pending_join_scan_callback(); + if (pending_scan_res_join_callback == NULL) { return {SupplicantStatusCode::FAILURE_UNKNOWN, "Failed to start scan."}; } return {SupplicantStatusCode::SUCCESS, ""}; |