Merge branch 'bugfix/httpd_stop' into 'master'

Check for failure in stopping http server [GitHub PR]

Closes IDFGH-7843

See merge request espressif/esp-idf!15904
This commit is contained in:
Mahavir Jain
2021-11-12 04:21:33 +00:00

View File

@@ -450,7 +450,11 @@ esp_err_t httpd_stop(httpd_handle_t handle)
struct httpd_ctrl_data msg; struct httpd_ctrl_data msg;
memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg));
msg.hc_msg = HTTPD_CTRL_SHUTDOWN; msg.hc_msg = HTTPD_CTRL_SHUTDOWN;
cs_send_to_ctrl_sock(hd->msg_fd, hd->config.ctrl_port, &msg, sizeof(msg)); int ret = 0;
if ((ret = cs_send_to_ctrl_sock(hd->msg_fd, hd->config.ctrl_port, &msg, sizeof(msg))) < 0) {
ESP_LOGE(TAG, "Failed to send shutdown signal err=%d", ret);
return ESP_FAIL;
}
ESP_LOGD(TAG, LOG_FMT("sent control msg to stop server")); ESP_LOGD(TAG, LOG_FMT("sent control msg to stop server"));
while (hd->hd_td.status != THREAD_STOPPED) { while (hd->hd_td.status != THREAD_STOPPED) {