forked from esphome/AsyncTCP
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
queue deadlock and congestion aviodance
- do not let `_remove_events_with_arg()` call to block on queue pertubation, otherwise it could deadlock - in any case do not block on adding LWIP_TCP_POLL event to the queue, it does not make much sense anyway due to poll events are repetitive - `_get_async_event()` will discard LWIP_TCP_POLL events when q gets filled up this will work in combination with throttling poll events when adding to the queue Poor designed apps and multiple parallel connections could flood the queue with interleaved poll events that can't be properly throttled or coalesced. So we can discard it in the eviction task after coalescing It will work in this way: - queue is up to 1/4 full - all events are entering the queue and serviced - queue is from 1/4 and up to 3/4 full - new poll events are throttled on enqueue with linear probability - queue is from 3/4 up to full top - all new poll events are ignored on enqueue and existing poll events already in the queue are discarded on eviction with linear probability giving away priority for all other events to be serviced. It is expected that on a new poll timer connection polls could reenter the queue
- Loading branch information
Showing
1 changed file
with
40 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters