call accept-callback with ERR_MEM when allocating a pcb fails on passive open to inform the application about this error; ATTENTION: applications have to handle NULL pcb in accept callback!

This commit is contained in:
sg
2016-03-23 21:57:38 +01:00
parent c6b742812d
commit 7721b20179
5 changed files with 26 additions and 7 deletions

View File

@@ -562,8 +562,10 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
we don't do anything, but rely on the sender will retransmit the
SYN at a time when we have more memory available. */
if (npcb == NULL) {
err_t err;
LWIP_DEBUGF(TCP_DEBUG, ("tcp_listen_input: could not allocate PCB\n"));
TCP_STATS_INC(tcp.memerr);
TCP_EVENT_ACCEPT(pcb, NULL, pcb->callback_arg, ERR_MEM, err);
return ERR_MEM;
}
#if TCP_LISTEN_BACKLOG
@@ -794,7 +796,7 @@ tcp_process(struct tcp_pcb *pcb)
{
tcp_backlog_accepted(pcb);
/* Call the accept function. */
TCP_EVENT_ACCEPT(pcb, ERR_OK, err);
TCP_EVENT_ACCEPT(pcb->listener, pcb, pcb->callback_arg, ERR_OK, err);
}
if (err != ERR_OK) {
/* If the accept function returns with an error, we abort