From 46247ca0298c33c69d5aca1e37fdbe204d989b3d Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 26 Aug 2019 12:11:45 -0700 Subject: [PATCH] Bringdown interface when stopping softap The interface should be brought down when stopping softap. --- .../TARGET_WHD/interface/WhdSoftAPInterface.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/features/netsocket/emac-drivers/TARGET_WHD/interface/WhdSoftAPInterface.cpp b/features/netsocket/emac-drivers/TARGET_WHD/interface/WhdSoftAPInterface.cpp index 17f99978b8..a13aff0b72 100644 --- a/features/netsocket/emac-drivers/TARGET_WHD/interface/WhdSoftAPInterface.cpp +++ b/features/netsocket/emac-drivers/TARGET_WHD/interface/WhdSoftAPInterface.cpp @@ -173,7 +173,19 @@ int WhdSoftAPInterface::stop(void) return NSAPI_ERROR_DHCP_FAILURE; } _dhcp_server.reset(); - return whd_wifi_stop_ap(_whd_emac.ifp); + + // bring down + int err = _interface->bringdown(); + if (err) { + return err; + } + + // stop softap + whd_result_t res = whd_wifi_stop_ap(_whd_emac.ifp); + if (res != WHD_SUCCESS) { + return whd_toerror(res); + } + return NSAPI_ERROR_OK; } int WhdSoftAPInterface::remove_custom_ie(const whd_custom_ie_info_t *ie_info)