mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 21:24:32 +02:00
Merge branch 'contrib/github_pr_8816' into 'master'
Don't ignore return value of `httpd_stop` (GitHub PR) Closes IDFGH-7222 See merge request espressif/esp-idf!18040
This commit is contained in:
@@ -160,8 +160,12 @@ esp_err_t httpd_ssl_start(httpd_handle_t *handle, httpd_ssl_config_t *config);
|
||||
* Stop the server. Blocks until the server is shut down.
|
||||
*
|
||||
* @param[in] handle
|
||||
* @return
|
||||
* - ESP_OK: Server stopped successfully
|
||||
* - ESP_ERR_INVALID_ARG: Invalid argument
|
||||
* - ESP_FAIL: Failure to shut down server
|
||||
*/
|
||||
void httpd_ssl_stop(httpd_handle_t handle);
|
||||
esp_err_t httpd_ssl_stop(httpd_handle_t handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -306,7 +306,7 @@ esp_err_t httpd_ssl_start(httpd_handle_t *pHandle, struct httpd_ssl_config *conf
|
||||
}
|
||||
|
||||
/** Stop the server */
|
||||
void httpd_ssl_stop(httpd_handle_t handle)
|
||||
esp_err_t httpd_ssl_stop(httpd_handle_t handle)
|
||||
{
|
||||
httpd_stop(handle);
|
||||
return httpd_stop(handle);
|
||||
}
|
||||
|
@@ -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 <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -85,8 +77,9 @@ static void stop_httpd_transport(protocomm_t *pc)
|
||||
{
|
||||
mdns_service_remove("_esp_local_ctrl", "_tcp");
|
||||
protocomm_httpd_stop(pc);
|
||||
httpd_ssl_stop(server_handle);
|
||||
if (httpd_ssl_stop(server_handle) == ESP_OK) {
|
||||
server_handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static esp_err_t copy_httpd_config(esp_local_ctrl_transport_config_t *dest_config, const esp_local_ctrl_transport_config_t *src_config)
|
||||
|
@@ -295,7 +295,11 @@ esp_err_t protocomm_httpd_stop(protocomm_t *pc)
|
||||
if ((pc != NULL) && (pc == pc_httpd)) {
|
||||
if (!pc_ext_httpd_handle_provided) {
|
||||
httpd_handle_t *server_handle = (httpd_handle_t *) pc_httpd->priv;
|
||||
httpd_stop(*server_handle);
|
||||
esp_err_t ret = httpd_stop(*server_handle);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to stop http server");
|
||||
return ret;
|
||||
}
|
||||
free(server_handle);
|
||||
} else {
|
||||
pc_ext_httpd_handle_provided = false;
|
||||
|
@@ -86,6 +86,7 @@ Names of variables holding different certs in :cpp:type:`httpd_ssl_config_t` str
|
||||
* :cpp:member:`httpd_ssl_config::cacert_pem` variable inherits role of `client_verify_cert_pem` variable
|
||||
* :cpp:member:`httpd_ssl_config::cacert_len` variable inherits role of `client_verify_cert_len` variable
|
||||
|
||||
The return type of the :cpp:func:`httpd_ssl_stop` API has been changed to :cpp:type:`esp_err_t` from ``void``.
|
||||
|
||||
ESP HTTPS OTA
|
||||
--------------
|
||||
|
@@ -182,10 +182,10 @@ static httpd_handle_t start_webserver(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void stop_webserver(httpd_handle_t server)
|
||||
static esp_err_t stop_webserver(httpd_handle_t server)
|
||||
{
|
||||
// Stop the httpd server
|
||||
httpd_stop(server);
|
||||
return httpd_stop(server);
|
||||
}
|
||||
|
||||
|
||||
@@ -195,8 +195,11 @@ static void disconnect_handler(void* arg, esp_event_base_t event_base,
|
||||
httpd_handle_t* server = (httpd_handle_t*) arg;
|
||||
if (*server) {
|
||||
ESP_LOGI(TAG, "Stopping webserver");
|
||||
stop_webserver(*server);
|
||||
if (stop_webserver(*server) == ESP_OK) {
|
||||
*server = NULL;
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Failed to stop http server");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -362,10 +362,10 @@ static httpd_handle_t start_webserver(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void stop_webserver(httpd_handle_t server)
|
||||
static esp_err_t stop_webserver(httpd_handle_t server)
|
||||
{
|
||||
// Stop the httpd server
|
||||
httpd_stop(server);
|
||||
return httpd_stop(server);
|
||||
}
|
||||
|
||||
static void disconnect_handler(void* arg, esp_event_base_t event_base,
|
||||
@@ -374,8 +374,11 @@ static void disconnect_handler(void* arg, esp_event_base_t event_base,
|
||||
httpd_handle_t* server = (httpd_handle_t*) arg;
|
||||
if (*server) {
|
||||
ESP_LOGI(TAG, "Stopping webserver");
|
||||
stop_webserver(*server);
|
||||
if (stop_webserver(*server) == ESP_OK) {
|
||||
*server = NULL;
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Failed to stop http server");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -140,10 +140,10 @@ static httpd_handle_t start_webserver(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void stop_webserver(httpd_handle_t server)
|
||||
static esp_err_t stop_webserver(httpd_handle_t server)
|
||||
{
|
||||
// Stop the httpd server
|
||||
httpd_stop(server);
|
||||
return httpd_stop(server);
|
||||
}
|
||||
|
||||
static void disconnect_handler(void* arg, esp_event_base_t event_base,
|
||||
@@ -152,8 +152,11 @@ static void disconnect_handler(void* arg, esp_event_base_t event_base,
|
||||
httpd_handle_t* server = (httpd_handle_t*) arg;
|
||||
if (*server) {
|
||||
ESP_LOGI(TAG, "Stopping webserver");
|
||||
stop_webserver(*server);
|
||||
if (stop_webserver(*server) == ESP_OK) {
|
||||
*server = NULL;
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Failed to stop http server");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -139,10 +139,10 @@ static httpd_handle_t start_webserver(void)
|
||||
return server;
|
||||
}
|
||||
|
||||
static void stop_webserver(httpd_handle_t server)
|
||||
static esp_err_t stop_webserver(httpd_handle_t server)
|
||||
{
|
||||
// Stop the httpd server
|
||||
httpd_ssl_stop(server);
|
||||
return httpd_ssl_stop(server);
|
||||
}
|
||||
|
||||
static void disconnect_handler(void* arg, esp_event_base_t event_base,
|
||||
@@ -150,8 +150,11 @@ static void disconnect_handler(void* arg, esp_event_base_t event_base,
|
||||
{
|
||||
httpd_handle_t* server = (httpd_handle_t*) arg;
|
||||
if (*server) {
|
||||
stop_webserver(*server);
|
||||
if (stop_webserver(*server) == ESP_OK) {
|
||||
*server = NULL;
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Failed to stop https server");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -206,12 +206,12 @@ static httpd_handle_t start_wss_echo_server(void)
|
||||
return server;
|
||||
}
|
||||
|
||||
static void stop_wss_echo_server(httpd_handle_t server)
|
||||
static esp_err_t stop_wss_echo_server(httpd_handle_t server)
|
||||
{
|
||||
// Stop keep alive thread
|
||||
wss_keep_alive_stop(httpd_get_global_user_ctx(server));
|
||||
// Stop the httpd server
|
||||
httpd_ssl_stop(server);
|
||||
return httpd_ssl_stop(server);
|
||||
}
|
||||
|
||||
static void disconnect_handler(void* arg, esp_event_base_t event_base,
|
||||
@@ -219,8 +219,11 @@ static void disconnect_handler(void* arg, esp_event_base_t event_base,
|
||||
{
|
||||
httpd_handle_t* server = (httpd_handle_t*) arg;
|
||||
if (*server) {
|
||||
stop_wss_echo_server(*server);
|
||||
if (stop_wss_echo_server(*server) == ESP_OK) {
|
||||
*server = NULL;
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Failed to stop https server");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -472,7 +472,6 @@ components/esp_local_ctrl/src/esp_local_ctrl.c
|
||||
components/esp_local_ctrl/src/esp_local_ctrl_handler.c
|
||||
components/esp_local_ctrl/src/esp_local_ctrl_priv.h
|
||||
components/esp_local_ctrl/src/esp_local_ctrl_transport_ble.c
|
||||
components/esp_local_ctrl/src/esp_local_ctrl_transport_httpd.c
|
||||
components/esp_netif/include/esp_netif_ppp.h
|
||||
components/esp_netif/include/esp_netif_slip.h
|
||||
components/esp_netif/loopback/esp_netif_loopback.c
|
||||
|
Reference in New Issue
Block a user