esp_http_server: Add linger in httpd_config_t

Closes: https://github.com/espressif/esp-idf/issues/9514
This commit is contained in:
Harshit Malpani
2022-09-14 11:06:40 +05:30
parent 57562b3a55
commit a3fd6d1070
2 changed files with 12 additions and 0 deletions

View File

@@ -354,6 +354,13 @@ void httpd_sess_delete(struct httpd_data *hd, struct sock_db *session)
}
ESP_LOGD(TAG, LOG_FMT("fd = %d"), session->fd);
if (hd->config.enable_so_linger) {
struct linger so_linger = {
.l_onoff = true,
.l_linger = hd->config.linger_timeout,
};
setsockopt(session->fd, SOL_SOCKET, SO_LINGER, &so_linger, sizeof(struct linger));
}
// Call close function if defined
if (hd->config.close_fn) {