Add extraconnsize

This commit is contained in:
Sergey Lyubka 2022-05-04 17:18:35 +01:00
parent 38557aac7f
commit b5fc0d30a8
4 changed files with 6 additions and 2 deletions

View File

@ -2687,7 +2687,8 @@ bool mg_aton(struct mg_str str, struct mg_addr *addr) {
}
struct mg_connection *mg_alloc_conn(struct mg_mgr *mgr) {
struct mg_connection *c = (struct mg_connection *) calloc(1, sizeof(*c));
struct mg_connection *c =
(struct mg_connection *) calloc(1, sizeof(*c) + mgr->extraconnsize);
if (c != NULL) {
c->mgr = mgr;
c->id = ++mgr->nextid;

View File

@ -910,6 +910,7 @@ struct mg_mgr {
void *active_dns_requests; // DNS requests in progress
struct mg_timer *timers; // Active timers
void *priv; // Used by the experimental stack
size_t extraconnsize; // Used by the experimental stack
#if MG_ARCH == MG_ARCH_FREERTOS_TCP
SocketSet_t ss; // NOTE(lsm): referenced from socket struct
#endif

View File

@ -139,7 +139,8 @@ bool mg_aton(struct mg_str str, struct mg_addr *addr) {
}
struct mg_connection *mg_alloc_conn(struct mg_mgr *mgr) {
struct mg_connection *c = (struct mg_connection *) calloc(1, sizeof(*c));
struct mg_connection *c =
(struct mg_connection *) calloc(1, sizeof(*c) + mgr->extraconnsize);
if (c != NULL) {
c->mgr = mgr;
c->id = ++mgr->nextid;

View File

@ -30,6 +30,7 @@ struct mg_mgr {
void *active_dns_requests; // DNS requests in progress
struct mg_timer *timers; // Active timers
void *priv; // Used by the experimental stack
size_t extraconnsize; // Used by the experimental stack
#if MG_ARCH == MG_ARCH_FREERTOS_TCP
SocketSet_t ss; // NOTE(lsm): referenced from socket struct
#endif