mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-29 16:25:54 +08:00
Invoke tcp_accepted() on the listening pcb
As required by the LWIP API PUBLISHED_FROM=7bfc6d816aa69f8fdd7592ade48b2d52e2d4991a
This commit is contained in:
parent
474e065a30
commit
104106b9cf
21
mongoose.c
21
mongoose.c
@ -14481,15 +14481,27 @@ void mg_lwip_handle_accept(struct mg_connection *nc) {
|
||||
}
|
||||
|
||||
static err_t mg_lwip_accept_cb(void *arg, struct tcp_pcb *newtpcb, err_t err) {
|
||||
struct mg_connection *lc = (struct mg_connection *) arg;
|
||||
DBG(("%p conn %p from %s:%u", lc, newtpcb,
|
||||
struct mg_connection *lc = (struct mg_connection *) arg, *nc;
|
||||
struct mg_lwip_conn_state *lcs, *cs;
|
||||
struct tcp_pcb_listen *lpcb;
|
||||
LOG(LL_INFO,
|
||||
("%p conn %p from %s:%u", lc, newtpcb,
|
||||
IPADDR_NTOA(ipX_2_ip(&newtpcb->remote_ip)), newtpcb->remote_port));
|
||||
struct mg_connection *nc = mg_if_accept_new_conn(lc);
|
||||
if (lc == NULL) {
|
||||
tcp_abort(newtpcb);
|
||||
return ERR_ABRT;
|
||||
}
|
||||
lcs = (struct mg_lwip_conn_state *) lc->sock;
|
||||
lpcb = (struct tcp_pcb_listen *) lcs->pcb.tcp;
|
||||
#if TCP_LISTEN_BACKLOG
|
||||
tcp_accepted(lpcb);
|
||||
#endif
|
||||
nc = mg_if_accept_new_conn(lc);
|
||||
if (nc == NULL) {
|
||||
tcp_abort(newtpcb);
|
||||
return ERR_ABRT;
|
||||
}
|
||||
struct mg_lwip_conn_state *cs = (struct mg_lwip_conn_state *) nc->sock;
|
||||
cs = (struct mg_lwip_conn_state *) nc->sock;
|
||||
cs->lc = lc;
|
||||
cs->pcb.tcp = newtpcb;
|
||||
/* We need to set up callbacks before returning because data may start
|
||||
@ -14503,6 +14515,7 @@ static err_t mg_lwip_accept_cb(void *arg, struct tcp_pcb *newtpcb, err_t err) {
|
||||
#endif
|
||||
mg_lwip_post_signal(MG_SIG_ACCEPT, nc);
|
||||
(void) err;
|
||||
(void) lpcb;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user