You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
web: replace sleep_for with strand-based fence in shutdown broadcast
The shutdown path used sleep_for(100ms) to give ASIO threads time to
flush the shutdown broadcast before tearing down the io_context. This
is fragile: 100ms is arbitrary and provides no delivery guarantee.
Add broadcastAndWait() to SessionRegistry which posts a fence lambda
to each session's strand after the write lambda. Since strands are
FIFO, the fence executes after the write is queued. A condition
variable collects all fence completions with a 2-second timeout as a
safety valve.
Each session now registers a PostFn alongside its SendFn. The PostFn
captures the session's strand and calls net::post(strand_, fn). If
the session is already destroyed (weak_ptr expired), the PostFn calls
the fence immediately so the counter still decrements.
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
0 commit comments