From 4db3fd17d927b74f2f585227517fd9b7d7a2cee9 Mon Sep 17 00:00:00 2001 From: FlorianR Date: Mon, 22 Nov 2021 11:55:24 +0100 Subject: [PATCH] Clarify when the socket is closed if a custom session closing callback is used When using a custom session closing callback, the IDF will not close the socket for the user. This might result in the system running out of fds. Without any note on that in the documentation, this is easy to miss. --- components/esp_http_server/include/esp_http_server.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/esp_http_server/include/esp_http_server.h b/components/esp_http_server/include/esp_http_server.h index 1c8b78583f..be9d0d9cd3 100644 --- a/components/esp_http_server/include/esp_http_server.h +++ b/components/esp_http_server/include/esp_http_server.h @@ -206,6 +206,9 @@ typedef struct httpd_config { * Called when a session is deleted, before freeing user and transport contexts and before * closing the socket. This is a place for custom de-init code common to all sockets. * + * The server will only close the socket if no custom session closing callback is set. + * If a custom callback is used, `close(sockfd)` should be called in here for most cases. + * * Set the user or transport context to NULL if it was freed here, so the server does not * try to free it again. *