tcp: changed accept handling to be done internally: the application does not have to call tcp_accepted() any more. Instead, when delaying accept (e.g. sockets do), call tcp_backlog_delayed()/tcp_backlog_accepted() (fixes bug #46696)

This commit is contained in:
sg
2016-03-22 07:30:44 +01:00
parent a1c78ea7bf
commit dd80759bb9
9 changed files with 176 additions and 86 deletions

View File

@@ -2286,12 +2286,10 @@ static err_t
http_accept(void *arg, struct tcp_pcb *pcb, err_t err)
{
struct http_state *hs;
struct tcp_pcb_listen *lpcb = (struct tcp_pcb_listen*)arg;
LWIP_UNUSED_ARG(arg);
LWIP_UNUSED_ARG(err);
LWIP_DEBUGF(HTTPD_DEBUG, ("http_accept %p / %p\n", (void*)pcb, arg));
/* Decrease the listen backlog counter */
tcp_accepted(lpcb);
/* Set priority */
tcp_setprio(pcb, HTTPD_TCP_PRIO);
@@ -2343,8 +2341,7 @@ httpd_init(void)
LWIP_ASSERT("httpd_init: tcp_bind failed", err == ERR_OK);
pcb = tcp_listen(pcb);
LWIP_ASSERT("httpd_init: tcp_listen failed", pcb != NULL);
/* initialize callback arg and accept callback */
tcp_arg(pcb, pcb);
/* initialize accept callback */
tcp_accept(pcb, http_accept);
}