Skip to content

Commit 9d2f186

Browse files
Replace queue v2 part2 (#58)
* Use simple intrusive linked list for queue Use a simple intrusive list for the event queue. The ultimate goal here is to arrange that certain kinds of events (errors) can be guaranteed to be queued, as client objects will leak if they are discarded. As a secondary improvement, there are some operations (peeking, remove_if) that can be more efficient as we can hold the queue lock for longer. This commit is a straight replacement and does not attempt any logic changes. * Factor common binding code * Purge queue when unbinding * _tcp_bind_api: Close automatically on failure This eliminates a round-trip through the LwIP lock and allows _tcp_close_api to specialize for AsyncClient. * Complete AsyncClient close on LwIP thread Ensure that _tcp_close completely disconnects a pcb from an AsyncClient - All callbacks are unhooked - All events are purged - abort() called on close() failure This fixes some race conditions with closing, particularly without CONFIG_LWIP_TCPIP_CORE_LOCKING, where an event might be processed for a now-dead client if it arrived after arg was cleared but before the callbacks were disconnected. * Add size cache to SimpleIntrusiveList Cache the list length to avoid performing expensive lookups during stochastic poll coaelescence. This can be removed later when the size() function is no longer necessary outside of a debug context. * Remove singleton pattern on queue mutex The creation check in the hot path comes at a measurable performance cost. --------- Co-authored-by: Mathieu Carbou <[email protected]>
1 parent cf97c13 commit 9d2f186

File tree

2 files changed

+308
-208
lines changed

2 files changed

+308
-208
lines changed

0 commit comments

Comments
 (0)