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

@@ -1,3 +1,22 @@
#include <stdlib.h> // for malloc and free
void* operator new(unsigned int size) { return malloc(size); }
void operator delete(void* ptr) { if (ptr) free(ptr); }
#include <memory>
#include <esp_heap_caps.h>
void* operator new(std::size_t count) {
return heap_caps_malloc(count, MALLOC_CAP_SPIRAM);
}
void operator delete(void* ptr) noexcept {
if (ptr) free(ptr);
}
/*
// C++17 only
void* operator new (std::size_t count, std::align_val_t alignment) {
return heap_caps_malloc(count, MALLOC_CAP_SPIRAM);
}
// C++17 only
void operator delete(void* ptr, std::align_val_t alignment) noexcept {
if (ptr) free(ptr);
}
*/