mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-10-18 07:33:01 +00:00
Each distinct sender ID allocated a coroutine and an unbounded channel that were released only at shutdown. Peer IDs are ephemeral and rotate, and the ID is taken straight off the wire, so the map grows without limit in ordinary use and can be grown deliberately by anyone in radio range. Cap it at 128 live actors. The map is access-ordered, so the entry dropped is the peer least recently *used*: evicting by insertion order would discard a long-lived active peer in favour of a burst of new IDs, which is the case worth protecting. Eviction closes the channel rather than cancelling it, so the actor drains what it already holds before finishing. Two of the four tests fail on main. The concurrency one does not — that race is timing-dependent — so it is there to hold the fix rather than to demonstrate the bug.