diff --git a/packages/cultmesh-rs/src/rudp_subscription.rs b/packages/cultmesh-rs/src/rudp_subscription.rs index 2faac085..c5824a5c 100644 --- a/packages/cultmesh-rs/src/rudp_subscription.rs +++ b/packages/cultmesh-rs/src/rudp_subscription.rs @@ -19,16 +19,18 @@ //! coalescing is the consumer's; and it must not block, because a slow wake delays the pump and so RUDP acks and //! resends. A panic in it is caught and discarded, payload included even when the payload's own drop panics: the //! pump survives and the event stays queued. (Under `panic = "abort"` a panicking wake aborts the process: nothing -//! can catch it.) It may call -//! `try_drain`, `subscribe`, `unsubscribe` or `resubscribe_all`; the closure exists before the client does, so it -//! reaches the client through a `Weak` (or a slot filled after `connect_with_wake` returns) and should hold it only -//! weakly: if the owner drops its handle while the wake holds an upgraded one, the wake's handle is the last, and -//! `Drop` then runs on the pump thread. There it signals the pump to end and does not join (a thread cannot join -//! itself), so the pump ends once the wake returns. A wake that held a strong handle for good would keep the client, -//! and so the pump, alive forever. It runs once more when the pump thread ends, after -//! `close` or `Drop` has sent the unsubscribes and the goodbye, and never again: a consumer blocked in its own wait -//! on another thread is released within the bounds above (500 ms of acknowledgement wait, a poll interval, and a -//! reconnect abandoned at its next poll) and its next `try_drain` returns what the pump had queued. +//! can catch it.) It may call `try_drain`, `subscribe`, `unsubscribe` or `resubscribe_all`. The closure exists +//! before the client does, so it reaches the client through a `Weak` (or a slot filled after `connect_with_wake` +//! returns) and should hold it only weakly: if the owner drops its handle while the wake holds an upgraded one, +//! the wake's handle is the last, and `Drop` then runs on the pump thread. There it signals the pump to end and +//! does not join (a thread cannot join itself), so the pump ends once the wake returns. A wake that held a strong +//! handle for good would keep the client, and so the pump, alive forever. +//! +//! The wake runs once more when the pump thread ends, after `close` or `Drop` has sent the unsubscribes and the +//! goodbye, and never again. Both consume the client, so by then there is nothing left to `try_drain`: that last +//! wake only releases a consumer blocked on its own wait (on another thread, within the bounds above: 500 ms of +//! acknowledgement wait, a poll interval, and a reconnect abandoned at its next poll), which learns the client is +//! gone from its own handle, a `Weak` that no longer upgrades. What the pump had queued ends with the client. //! //! Bounds: the assembler bounds what it holds of incomplete commits and faults the connection past that. What the //! caller has not drained is bounded too, by [`CultMeshRudpSubscriptionOptions::max_undrained`], counted in