mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
6aff5b7ccd
* perf(pico): implement O(1) session lookup for pico connections - Replace `sync.Map` with `connections` and `sessionConnections`. - Add `addConnection`, `removeConnection`, `sessionConnectionsSnapshot`, and `takeAllConnections` with `connsMu` for concurrency. - `broadcastToSession` now dispatches directly to `sessionConnections`. - Add `newUniqueConnID` to avoid UUID collision/overwrites. - Ensure `Stop` and `readLoop` use the new helpers for safe cleanup and correct `connCount` updates. * refactor(pico): replace addConnection with createAndAddConnection for atomic connID generation * refactor(pico): clear connections in one time to improve perf Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix(pico): keep connCount consistent with connection indexes * refactor(pico): make connCount a regular int guarded by connsMu * fix(pico): enforce MaxConnections atomically on registration * fix(pico): use temporary over-limit error and remove conn counter --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>