From db914d62724c335796db9d7e557935bdafe0da98 Mon Sep 17 00:00:00 2001 From: Laukik Hase Date: Mon, 31 Jan 2022 15:03:54 +0530 Subject: [PATCH] wifi_prov_mgr: Fix provisioning not stopping in release mode - For the wifi_prov_mgr example in release mode (with NDEBUG defined - assertions disabled), the task to stop provisioning is never started as it is voided by the assert function it is called in. Closes https://github.com/espressif/esp-idf/issues/8309 --- components/wifi_provisioning/src/manager.c | 24 ++++++++-------------- tools/ci/check_copyright_ignore.txt | 1 - 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/components/wifi_provisioning/src/manager.c b/components/wifi_provisioning/src/manager.c index de80f34659..945b911508 100644 --- a/components/wifi_provisioning/src/manager.c +++ b/components/wifi_provisioning/src/manager.c @@ -1,16 +1,8 @@ -// Copyright 2019 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include @@ -623,8 +615,10 @@ static bool wifi_prov_mgr_stop_service(bool blocking) * released - some duration after - returning from a call to * wifi_prov_mgr_stop_provisioning(), like when it is called * inside a protocomm handler */ - assert(xTaskCreate(prov_stop_task, "prov_stop_task", 4096, (void *)1, - tskIDLE_PRIORITY, NULL) == pdPASS); + if (xTaskCreate(prov_stop_task, "prov_stop_task", 4096, (void *)1, tskIDLE_PRIORITY, NULL) != pdPASS) { + ESP_LOGE(TAG, "Failed to create prov_stop_task!"); + abort(); + } ESP_LOGD(TAG, "Provisioning scheduled for stopping"); } return true; diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 002243f43d..4919561382 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -2099,7 +2099,6 @@ components/wifi_provisioning/python/wifi_config_pb2.py components/wifi_provisioning/python/wifi_constants_pb2.py components/wifi_provisioning/python/wifi_scan_pb2.py components/wifi_provisioning/src/handlers.c -components/wifi_provisioning/src/manager.c components/wifi_provisioning/src/scheme_console.c components/wifi_provisioning/src/wifi_config.c components/wifi_provisioning/src/wifi_provisioning_priv.h