Two bugs in the buffered ws_* tracking writes:
- untrackChannelConnection() read array_keys($this->channel_connections)
before it unset an emptied channel, so ws_active_channels kept listing a
channel after its last socket unsubscribed or had its subscribe refused.
The list is now read after the unset.
- flushCacheBuffer() deletes after it writes. When a channel was emptied
and joined again in the same loop tick, the buffered delete of
ws_channel_connections_<name> ran after the buffered write and the cache
showed no sockets for a channel that had one. A buffered write now
cancels an earlier buffered delete of the same key.
Tests: the last unsubscribe and a refused re-subscribe of the last tracked
socket drop the channel from ws_active_channels; a channel emptied and
joined in one tick keeps the new socket in its cache entry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>