mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-10 16:31:44 +00:00
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:
1 parent
311fdb8bac
commit
def2f39724
2 files changed
+8
No files matched your search
@@ -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_connection *lc = (struct mg_connection *) arg, *nc;
|
||||||
struct mg_lwip_conn_state *lcs, *cs;
|
struct mg_lwip_conn_state *lcs, *cs;
|
||||||
struct tcp_pcb_listen *lpcb;
|
struct tcp_pcb_listen *lpcb;
|
||||||
|
if (newtpcb == NULL) {
|
||||||
|
LOG(LL_ERROR, ("%p accept error %d", lc, (int) err));
|
||||||
|
return ERR_ABRT;
|
||||||
|
}
|
||||||
LOG(LL_DEBUG,
|
LOG(LL_DEBUG,
|
||||||
("%p conn %p from %s:%u", lc, newtpcb,
|
("%p conn %p from %s:%u", lc, newtpcb,
|
||||||
IPADDR_NTOA(ipX_2_ip(&newtpcb->remote_ip)), newtpcb->remote_port));
|
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_connection *lc = (struct mg_connection *) arg, *nc;
|
||||||
struct mg_lwip_conn_state *lcs, *cs;
|
struct mg_lwip_conn_state *lcs, *cs;
|
||||||
struct tcp_pcb_listen *lpcb;
|
struct tcp_pcb_listen *lpcb;
|
||||||
|
if (newtpcb == NULL) {
|
||||||
|
LOG(LL_ERROR, ("%p accept error %d", lc, (int) err));
|
||||||
|
return ERR_ABRT;
|
||||||
|
}
|
||||||
LOG(LL_DEBUG,
|
LOG(LL_DEBUG,
|
||||||
("%p conn %p from %s:%u", lc, newtpcb,
|
("%p conn %p from %s:%u", lc, newtpcb,
|
||||||
IPADDR_NTOA(ipX_2_ip(&newtpcb->remote_ip)), newtpcb->remote_port));
|
IPADDR_NTOA(ipX_2_ip(&newtpcb->remote_ip)), newtpcb->remote_port));
|
||||||
|
|||||||
Reference in new issue
Block a user