mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
fix(http_server): Removed the build failure due to unused variables
There were build failure due the unused variable last_error when ESP_HTTPS_SERVER_EVENTS and HTTPD_ENABLE_EVENTS are disabled
This commit is contained in:
committed by
Mahavir Jain
parent
bd85dad2cf
commit
bdf438f0aa
@@ -23,6 +23,10 @@ extern "C" {
|
||||
|
||||
#define ESP_HTTPD_DEF_CTRL_PORT (32768) /*!< HTTP Server control socket port*/
|
||||
|
||||
#if CONFIG_HTTPD_ENABLE_EVENTS || __DOXYGEN_
|
||||
ESP_EVENT_DECLARE_BASE(ESP_HTTP_SERVER_EVENT);
|
||||
#endif // CONFIG_HTTPD_ENABLE_EVENTS || __DOXYGEN_
|
||||
|
||||
/**
|
||||
* @brief HTTP Server events id
|
||||
*/
|
||||
@@ -38,15 +42,11 @@ typedef enum {
|
||||
HTTP_SERVER_EVENT_STOP, /*!< This event occurs when HTTP Server is stopped */
|
||||
} esp_http_server_event_id_t;
|
||||
|
||||
#if CONFIG_HTTPD_ENABLE_EVENTS || __DOXYGEN_
|
||||
ESP_EVENT_DECLARE_BASE(ESP_HTTP_SERVER_EVENT);
|
||||
|
||||
/** Argument structure for HTTP_SERVER_EVENT_ON_DATA and HTTP_SERVER_EVENT_SENT_DATA event */
|
||||
typedef struct {
|
||||
int fd; /*!< Session socket file descriptor */
|
||||
int data_len; /*!< Data length */
|
||||
} esp_http_server_event_data;
|
||||
#endif // CONFIG_HTTPD_ENABLE_EVENTS || __DOXYGEN_
|
||||
|
||||
/*
|
||||
note: esp_https_server.h includes a customized copy of this
|
||||
|
||||
@@ -597,13 +597,17 @@ esp_err_t httpd_sess_trigger_close_(httpd_handle_t handle, struct sock_db *sessi
|
||||
void esp_http_server_dispatch_event(int32_t event_id, const void* event_data, size_t event_data_size);
|
||||
|
||||
#else // CONFIG_HTTPD_ENABLE_EVENTS
|
||||
#define esp_http_server_dispatch_event(event_id, event_data, event_data_size) do {} while(0)
|
||||
static inline void esp_http_server_dispatch_event(int32_t event_id, const void* event_data, size_t event_data_size)
|
||||
{
|
||||
// Events disabled, do nothing
|
||||
(void) event_id;
|
||||
(void) event_data;
|
||||
(void) event_data_size;
|
||||
}
|
||||
#endif // CONFIG_HTTPD_ENABLE_EVENTS
|
||||
|
||||
|
||||
esp_err_t httpd_crypto_sha1(const uint8_t *data, size_t data_len, uint8_t *hash);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -312,14 +312,12 @@ esp_err_t httpd_resp_send(httpd_req_t *r, const char *buf, ssize_t buf_len)
|
||||
return ESP_ERR_HTTPD_RESP_SEND;
|
||||
}
|
||||
}
|
||||
hd->http_server_state = HTTP_SERVER_EVENT_SENT_DATA;
|
||||
#ifdef CONFIG_HTTPD_ENABLE_EVENTS
|
||||
esp_http_server_event_data evt_data = {
|
||||
.fd = ra->sd->fd,
|
||||
.data_len = buf_len,
|
||||
};
|
||||
hd->http_server_state = HTTP_SERVER_EVENT_SENT_DATA;
|
||||
esp_http_server_dispatch_event(HTTP_SERVER_EVENT_SENT_DATA, &evt_data, sizeof(esp_http_server_event_data));
|
||||
#endif // CONFIG_HTTPD_ENABLE_EVENTS
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@@ -414,14 +412,12 @@ esp_err_t httpd_resp_send_chunk(httpd_req_t *r, const char *buf, ssize_t buf_len
|
||||
if (httpd_send_all(r, "\r\n", strlen("\r\n")) != ESP_OK) {
|
||||
return ESP_ERR_HTTPD_RESP_SEND;
|
||||
}
|
||||
hd->http_server_state = HTTP_SERVER_EVENT_SENT_DATA;
|
||||
#ifdef CONFIG_HTTPD_ENABLE_EVENTS
|
||||
esp_http_server_event_data evt_data = {
|
||||
.fd = ra->sd->fd,
|
||||
.data_len = buf_len,
|
||||
};
|
||||
hd->http_server_state = HTTP_SERVER_EVENT_SENT_DATA;
|
||||
esp_http_server_dispatch_event(HTTP_SERVER_EVENT_SENT_DATA, &evt_data, sizeof(esp_http_server_event_data));
|
||||
#endif // CONFIG_HTTPD_ENABLE_EVENTS
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -632,13 +628,11 @@ int httpd_req_recv(httpd_req_t *r, char *buf, size_t buf_len)
|
||||
ESP_LOGD(TAG, LOG_FMT("received length = %d"), ret);
|
||||
struct httpd_data *hd = (struct httpd_data *) r->handle;
|
||||
hd->http_server_state = HTTP_SERVER_EVENT_ON_DATA;
|
||||
#ifdef CONFIG_HTTPD_ENABLE_EVENTS
|
||||
esp_http_server_event_data evt_data = {
|
||||
.fd = ra->sd->fd,
|
||||
.data_len = ret,
|
||||
};
|
||||
esp_http_server_dispatch_event(HTTP_SERVER_EVENT_ON_DATA, &evt_data, sizeof(esp_http_server_event_data));
|
||||
#endif // CONFIG_HTTPD_ENABLE_EVENTS
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ extern "C" {
|
||||
|
||||
#if CONFIG_ESP_HTTPS_SERVER_EVENTS || __DOXYGEN__
|
||||
ESP_EVENT_DECLARE_BASE(ESP_HTTPS_SERVER_EVENT);
|
||||
#endif // CONFIG_ESP_HTTPS_SERVER_EVENTS || __DOXYGEN__
|
||||
|
||||
typedef enum {
|
||||
HTTPS_SERVER_EVENT_ERROR = 0, /*!< This event occurs when there are any errors during execution */
|
||||
@@ -30,7 +31,6 @@ typedef enum {
|
||||
HTTPS_SERVER_EVENT_DISCONNECTED, /*!< The connection has been disconnected */
|
||||
HTTPS_SERVER_EVENT_STOP, /*!< This event occurs when HTTPS Server is stopped */
|
||||
} esp_https_server_event_id_t;
|
||||
#endif // CONFIG_ESP_HTTPS_SERVER_EVENTS || __DOXYGEN__
|
||||
|
||||
typedef enum {
|
||||
HTTPD_SSL_TRANSPORT_SECURE, // SSL Enabled
|
||||
|
||||
@@ -40,7 +40,13 @@ static void http_dispatch_event_to_event_loop(int32_t event_id, const void* even
|
||||
}
|
||||
}
|
||||
#else // CONFIG_ESP_HTTPS_SERVER_EVENTS
|
||||
#define http_dispatch_event_to_event_loop(event_id, event_data, event_data_size) do {} while (0)
|
||||
static void http_dispatch_event_to_event_loop(int32_t event_id, const void* event_data, size_t event_data_size)
|
||||
{
|
||||
// Events disabled, do nothing
|
||||
(void) event_id;
|
||||
(void) event_data;
|
||||
(void) event_data_size;
|
||||
}
|
||||
#endif // CONFIG_ESP_HTTPS_SERVER_EVENTS
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user