mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 23:54:33 +01:00
The stages map was protected by two incompatible locks: the embedded Server.Mutex and Server.stagesLock (RWMutex). Since these are separate mutexes they don't exclude each other, and many handlers accessed the map with no lock at all. Route all stages map access through stagesLock: read-only lookups use RLock, writes (create/delete) use Lock. Per-stage field mutations continue to use each stage's own RWMutex. Restructure handleMsgSysUnlockStage to avoid holding stagesLock nested inside a stage RLock, preventing potential deadlock with destructEmptyStages.