@@ -65,7 +65,7 @@ extern "C" {
65
65
TCP poll interval is specified in terms of the TCP coarse timer interval, which is called twice a second
66
66
https://github.com/espressif/esp-lwip/blob/2acf959a2bb559313cd2bf9306c24612ba3d0e19/src/core/tcp.c#L1895
67
67
*/
68
- #define CONFIG_ASYNC_TCP_POLL_TIMER 1
68
+ #define CONFIG_ASYNC_TCP_POLL_TIMER 1
69
69
70
70
/*
71
71
* TCP/IP Event Task
@@ -179,9 +179,9 @@ static inline bool _get_async_event(lwip_event_packet_t** e) {
179
179
todo: implement some kind of fair dequeing or (better) simply punish user for a bad designed callbacks by resetting hog connections
180
180
*/
181
181
lwip_event_packet_t * next_pkt = NULL ;
182
- while (xQueuePeek (_async_queue, &next_pkt, 0 ) == pdPASS){
183
- if (next_pkt->arg == (*e)->arg && next_pkt->event == LWIP_TCP_POLL){
184
- if (xQueueReceive (_async_queue, &next_pkt, 0 ) == pdPASS){
182
+ while (xQueuePeek (_async_queue, &next_pkt, 0 ) == pdPASS) {
183
+ if (next_pkt->arg == (*e)->arg && next_pkt->event == LWIP_TCP_POLL) {
184
+ if (xQueueReceive (_async_queue, &next_pkt, 0 ) == pdPASS) {
185
185
free (next_pkt);
186
186
next_pkt = NULL ;
187
187
log_d (" coalescing polls, network congestion or async callbacks might be too slow!" );
@@ -225,7 +225,7 @@ static bool _remove_events_with_arg(void* arg) {
225
225
free (first_packet);
226
226
first_packet = NULL ;
227
227
228
- // try to return first packet to the back of the queue
228
+ // try to return first packet to the back of the queue
229
229
} else if (xQueueSend (_async_queue, &first_packet, 0 ) != pdPASS) {
230
230
// we can't wait here if queue is full, because this call has been done from the only consumer task of this queue
231
231
// otherwise it would deadlock, we have to discard the event
@@ -374,7 +374,7 @@ static int8_t _tcp_connected(void* arg, tcp_pcb* pcb, int8_t err) {
374
374
375
375
static int8_t _tcp_poll (void * arg, struct tcp_pcb * pcb) {
376
376
// throttle polling events queing when event queue is getting filled up, let it handle _onack's
377
- // log_d("qs:%u", uxQueueMessagesWaiting(_async_queue));
377
+ // log_d("qs:%u", uxQueueMessagesWaiting(_async_queue));
378
378
if (uxQueueMessagesWaiting (_async_queue) > (rand () % CONFIG_ASYNC_TCP_QUEUE_SIZE / 2 + CONFIG_ASYNC_TCP_QUEUE_SIZE / 4 )) {
379
379
log_d (" throttling" );
380
380
return ERR_OK;
0 commit comments