mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-10-18 07:33:01 +00:00
This class exists to give each peer one actor so that peer's packets are processed sequentially — the comment says it prevents a session-management race. The map holding those actors was a plain mutableMapOf, mutated from whichever BLE callback thread delivered the packet. So the guarantee did not hold. Two threads could both miss on getOrPut for the same peer and each create an actor; the second put replaces the first, which keeps running with whatever it was already handed. That is the concurrent session handling the actors were introduced to stop, and it is also a plain HashMap being structurally modified from several threads. Also drops peerActors, declared next to it and referenced nowhere.