diff --git a/mongoose.c b/mongoose.c index baefd399..d27fb4cf 100644 --- a/mongoose.c +++ b/mongoose.c @@ -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; diff --git a/mongoose.h b/mongoose.h index cc895b8d..2c1c882c 100644 --- a/mongoose.h +++ b/mongoose.h @@ -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 diff --git a/src/net.c b/src/net.c index 93d81087..14fde456 100644 --- a/src/net.c +++ b/src/net.c @@ -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; diff --git a/src/net.h b/src/net.h index e47bdfb0..88b64f2f 100644 --- a/src/net.h +++ b/src/net.h @@ -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