mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-24 01:25:36 +00:00
feat(httpd): add support for asynchronous request handling
This commit adds support for handling multiple requests simultaneously by introducing two new functions: `httpd_req_async_handler_begin()` and `httpd_req_async_handler_complete()`. These functions allow creating an asynchronous copy of a request that can be used on a separate thread and marking the asynchronous request as completed, respectively. Additionally, a new flag `for_async_req` has been added to the `httpd_sess_t` struct to indicate if a socket is being used for an asynchronous request and should not be purged from the LRU cache. An example have been added to demonstrate the usage of these new functions. Closes https://github.com/espressif/esp-idf/issues/10594 Signed-off-by: Harshit Malpani <harshit.malpani@espressif.com>
This commit is contained in:

committed by
Harshit Malpani

parent
1d25057a24
commit
3824eba04d
@@ -107,10 +107,13 @@ static int enum_function(struct sock_db *session, void *context)
|
||||
if (session->fd == -1) {
|
||||
return 0;
|
||||
}
|
||||
// Check/update lowest lru
|
||||
if (session->lru_counter < ctx->lru_counter) {
|
||||
ctx->lru_counter = session->lru_counter;
|
||||
ctx->session = session;
|
||||
// Only close sockets that are not in use
|
||||
if (session->for_async_req == false) {
|
||||
// Check/update lowest lru
|
||||
if (session->lru_counter < ctx->lru_counter) {
|
||||
ctx->lru_counter = session->lru_counter;
|
||||
ctx->session = session;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HTTPD_TASK_CLOSE:
|
||||
|
Reference in New Issue
Block a user