fix(network/http_server): fix clang-tidy warnings for missing close

Cherry-picked from 68b37333049383659d6ea73fa11a1d942994535a
This commit is contained in:
Tomas Rohlinek
2026-06-22 11:02:00 +02:00
committed by Tomáš Rohlínek
parent f0c56302a6
commit 6fe27247e6
+5 -3
View File
@@ -48,7 +48,7 @@ void esp_http_server_dispatch_event(int32_t event_id, const void* event_data, si
}
}
static esp_err_t httpd_accept_conn(struct httpd_data *hd, int listen_fd)
static esp_err_t httpd_accept_conn(struct httpd_data *hd)
{
/* If no space is available for new session, close the least recently used one */
if (hd->config.lru_purge_enable == true) {
@@ -71,11 +71,13 @@ static esp_err_t httpd_accept_conn(struct httpd_data *hd, int listen_fd)
struct sockaddr_storage addr_from;
socklen_t addr_from_len = sizeof(addr_from);
int new_fd = accept(listen_fd, (struct sockaddr *)&addr_from, &addr_from_len);
int new_fd = accept(hd->listen_fd, (struct sockaddr *)&addr_from, &addr_from_len);
if (new_fd < 0) {
ESP_LOGE(TAG, LOG_FMT("error in accept (%d)"), errno);
return ESP_FAIL;
}
ESP_LOGD(TAG, LOG_FMT("newfd = %d"), new_fd);
struct timeval tv;
@@ -317,7 +319,7 @@ static esp_err_t httpd_server(struct httpd_data *hd)
* process? */
if (FD_ISSET(hd->listen_fd, &read_set)) {
ESP_LOGD(TAG, LOG_FMT("processing listen socket %d"), hd->listen_fd);
if (httpd_accept_conn(hd, hd->listen_fd) != ESP_OK) {
if (httpd_accept_conn(hd) != ESP_OK) {
ESP_LOGW(TAG, LOG_FMT("error accepting new connection"));
}
}