fix(esp_http_server): prevent concurrent access to socket used in async http requests

This commit is contained in:
Friedolin Gröger
2024-07-16 10:46:50 +02:00
parent 5ca9f2a49a
commit 4a7f371056
3 changed files with 11 additions and 3 deletions

View File

@@ -72,6 +72,7 @@ static int enum_function(struct sock_db *session, void *context)
case HTTPD_TASK_INIT:
session->fd = -1;
session->ctx = NULL;
session->for_async_req = false;
break;
// Get active session
case HTTPD_TASK_GET_ACTIVE:
@@ -87,7 +88,7 @@ static int enum_function(struct sock_db *session, void *context)
break;
// Set descriptor
case HTTPD_TASK_SET_DESCRIPTOR:
if (session->fd != -1) {
if (session->fd != -1 && !session->for_async_req) {
FD_SET(session->fd, ctx->fdset);
if (session->fd > ctx->max_fd) {
ctx->max_fd = session->fd;