move to stock esp_http_server but keep it under control

- means 3 sockets are used (data + 2 for control)
- but LRU is activated (uses the 2 extra sockets to wake from select)
- backlog is just 1 (listen)
- only 3 sockets can be consumed before LRU activates
- for now, connections are kept-alive
This commit is contained in:
Philippe G
2021-12-14 11:52:51 -08:00
parent 412880d628
commit a266c07114
12 changed files with 117 additions and 460 deletions

View File

@@ -22,7 +22,6 @@
#include "http_server_handlers.h"
#include "esp_log.h"
#include "esp_http_server.h"
#include "_esp_http_server.h"
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
@@ -135,14 +134,16 @@ esp_err_t http_server_start()
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
config.max_uri_handlers = 25;
config.max_open_sockets = 8;
config.max_open_sockets = 3;
config.lru_purge_enable = true;
config.backlog_conn = 1;
config.uri_match_fn = httpd_uri_match_wildcard;
config.task_priority = ESP_TASK_PRIO_MIN;
//todo: use the endpoint below to configure session token?
// config.open_fn
ESP_LOGD(TAG, "Starting HTTP Server");
esp_err_t err= __httpd_start(&_server, &config);
esp_err_t err= httpd_start(&_server, &config);
if(err != ESP_OK){
ESP_LOGE_LOC(TAG,"Start server failed");
}