mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-10 09:33:44 +08:00
altcp: allocate altcp_pcbs from a pool, not from heap (new option MEMP_NUM_ALTCP_PCB defaults to MEMP_NUM_TCP_PCB)
This commit is contained in:
@@ -59,8 +59,7 @@ extern const struct altcp_functions altcp_tcp_functions;
|
||||
struct altcp_pcb *
|
||||
altcp_alloc(void)
|
||||
{
|
||||
/* FIXME: pool alloc */
|
||||
struct altcp_pcb *ret = (struct altcp_pcb *)mem_malloc(sizeof(struct altcp_pcb));
|
||||
struct altcp_pcb *ret = (struct altcp_pcb *)memp_malloc(MEMP_ALTCP_PCB);
|
||||
if (ret != NULL) {
|
||||
memset(ret, 0, sizeof(struct altcp_pcb));
|
||||
}
|
||||
@@ -70,9 +69,8 @@ altcp_alloc(void)
|
||||
void
|
||||
altcp_free(struct altcp_pcb *conn)
|
||||
{
|
||||
/* FIXME: pool alloc */
|
||||
if (conn) {
|
||||
mem_free(conn);
|
||||
memp_free(MEMP_ALTCP_PCB, conn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/priv/tcp_priv.h"
|
||||
#include "lwip/altcp.h"
|
||||
#include "lwip/ip4_frag.h"
|
||||
#include "lwip/netbuf.h"
|
||||
#include "lwip/api.h"
|
||||
|
||||
Reference in New Issue
Block a user