lwip: Check for accepted connection being NULL

This happens when lwip runs out of pcbs and just communicates an error.
This commit is contained in:
Deomid Ryabkov committed 2021-11-24 02:43:42 +00:00
1 parent 311fdb8bac
commit def2f39724
2 files changed
+8

No files matched your search

+4
View File
@@ -15308,6 +15308,10 @@ static err_t mg_lwip_accept_cb(void *arg, struct tcp_pcb *newtpcb, err_t err) {
struct mg_connection *lc = (struct mg_connection *) arg, *nc;
struct mg_lwip_conn_state *lcs, *cs;
struct tcp_pcb_listen *lpcb;
if (newtpcb == NULL) {
LOG(LL_ERROR, ("%p accept error %d", lc, (int) err));
return ERR_ABRT;
}
LOG(LL_DEBUG,
("%p conn %p from %s:%u", lc, newtpcb,
IPADDR_NTOA(ipX_2_ip(&newtpcb->remote_ip)), newtpcb->remote_port));
@@ -383,6 +383,10 @@ static err_t mg_lwip_accept_cb(void *arg, struct tcp_pcb *newtpcb, err_t err) {
struct mg_connection *lc = (struct mg_connection *) arg, *nc;
struct mg_lwip_conn_state *lcs, *cs;
struct tcp_pcb_listen *lpcb;
if (newtpcb == NULL) {
LOG(LL_ERROR, ("%p accept error %d", lc, (int) err));
return ERR_ABRT;
}
LOG(LL_DEBUG,
("%p conn %p from %s:%u", lc, newtpcb,
IPADDR_NTOA(ipX_2_ip(&newtpcb->remote_ip)), newtpcb->remote_port));