@@ -354,6 +354,7 @@ static int8_t _tcp_clear_events(void *arg) {
354
354
e->arg = arg;
355
355
if (!_prepend_async_event (&e)) {
356
356
free ((void *)(e));
357
+ log_e (" Failed to queue event: LWIP_TCP_CLEAR" );
357
358
return ERR_TIMEOUT;
358
359
}
359
360
return ERR_OK;
@@ -372,6 +373,7 @@ static int8_t _tcp_connected(void *arg, tcp_pcb *pcb, int8_t err) {
372
373
e->connected .err = err;
373
374
if (!_prepend_async_event (&e)) {
374
375
free ((void *)(e));
376
+ log_e (" Failed to queue event: LWIP_TCP_CONNECTED" );
375
377
return ERR_TIMEOUT;
376
378
}
377
379
return ERR_OK;
@@ -397,6 +399,7 @@ static int8_t _tcp_poll(void *arg, struct tcp_pcb *pcb) {
397
399
// poll events are not critical 'cause those are repetitive, so we may not wait the queue in any case
398
400
if (!_send_async_event (&e, 0 )) {
399
401
free ((void *)(e));
402
+ log_e (" Failed to queue event: LWIP_TCP_POLL" );
400
403
return ERR_TIMEOUT;
401
404
}
402
405
return ERR_OK;
@@ -425,6 +428,7 @@ static int8_t _tcp_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *pb, int8_t
425
428
}
426
429
if (!_send_async_event (&e)) {
427
430
free ((void *)(e));
431
+ log_e (" Failed to queue event: LWIP_TCP_RECV or LWIP_TCP_FIN" );
428
432
return ERR_TIMEOUT;
429
433
}
430
434
return ERR_OK;
@@ -443,6 +447,7 @@ static int8_t _tcp_sent(void *arg, struct tcp_pcb *pcb, uint16_t len) {
443
447
e->sent .len = len;
444
448
if (!_send_async_event (&e)) {
445
449
free ((void *)(e));
450
+ log_e (" Failed to queue event: LWIP_TCP_SENT" );
446
451
return ERR_TIMEOUT;
447
452
}
448
453
return ERR_OK;
@@ -460,6 +465,7 @@ static void _tcp_error(void *arg, int8_t err) {
460
465
e->error .err = err;
461
466
if (!_send_async_event (&e)) {
462
467
free ((void *)(e));
468
+ log_e (" Failed to queue event: LWIP_TCP_ERROR" );
463
469
}
464
470
}
465
471
@@ -480,6 +486,7 @@ static void _tcp_dns_found(const char *name, struct ip_addr *ipaddr, void *arg)
480
486
}
481
487
if (!_send_async_event (&e)) {
482
488
free ((void *)(e));
489
+ log_e (" Failed to queue event: LWIP_TCP_DNS" );
483
490
}
484
491
}
485
492
@@ -495,6 +502,7 @@ static int8_t _tcp_accept(void *arg, AsyncClient *client) {
495
502
e->accept .client = client;
496
503
if (!_prepend_async_event (&e)) {
497
504
free ((void *)(e));
505
+ log_e (" Failed to queue event: LWIP_TCP_ACCEPT" );
498
506
return ERR_TIMEOUT;
499
507
}
500
508
return ERR_OK;
@@ -536,6 +544,8 @@ static err_t _tcp_output_api(struct tcpip_api_call_data *api_call_msg) {
536
544
msg->err = ERR_CONN;
537
545
if (msg->closed_slot == INVALID_CLOSED_SLOT || !_closed_slots[msg->closed_slot ]) {
538
546
msg->err = tcp_output (msg->pcb );
547
+ } else {
548
+ log_e (" pcb was closed before reaching LwIP task" );
539
549
}
540
550
return msg->err ;
541
551
}
@@ -556,6 +566,8 @@ static err_t _tcp_write_api(struct tcpip_api_call_data *api_call_msg) {
556
566
msg->err = ERR_CONN;
557
567
if (msg->closed_slot == INVALID_CLOSED_SLOT || !_closed_slots[msg->closed_slot ]) {
558
568
msg->err = tcp_write (msg->pcb , msg->write .data , msg->write .size , msg->write .apiflags );
569
+ } else {
570
+ log_e (" pcb was closed before reaching LwIP task" );
559
571
}
560
572
return msg->err ;
561
573
}
@@ -582,6 +594,8 @@ static err_t _tcp_recved_api(struct tcpip_api_call_data *api_call_msg) {
582
594
// if(msg->closed_slot != INVALID_CLOSED_SLOT) {
583
595
msg->err = 0 ;
584
596
tcp_recved (msg->pcb , msg->received );
597
+ } else {
598
+ log_e (" pcb was closed before reaching LwIP task" );
585
599
}
586
600
return msg->err ;
587
601
}
@@ -603,6 +617,8 @@ static err_t _tcp_close_api(struct tcpip_api_call_data *api_call_msg) {
603
617
msg->err = ERR_CONN;
604
618
if (msg->closed_slot == INVALID_CLOSED_SLOT || !_closed_slots[msg->closed_slot ]) {
605
619
msg->err = tcp_close (msg->pcb );
620
+ } else {
621
+ log_e (" pcb was closed before reaching LwIP task" );
606
622
}
607
623
return msg->err ;
608
624
}
@@ -623,6 +639,8 @@ static err_t _tcp_abort_api(struct tcpip_api_call_data *api_call_msg) {
623
639
msg->err = ERR_CONN;
624
640
if (msg->closed_slot == INVALID_CLOSED_SLOT || !_closed_slots[msg->closed_slot ]) {
625
641
tcp_abort (msg->pcb );
642
+ } else {
643
+ log_e (" pcb was closed before reaching LwIP task" );
626
644
}
627
645
return msg->err ;
628
646
}
0 commit comments