refactor(channelserver): extract QuestCache from Server struct

The quest cache fields (lock, data map, expiry map) were spread across
Server with manual lock management. The old read path also missed the
RLock entirely, creating a data race. Encapsulating in a dedicated type
fixes the race and reduces Server's field count by 2.
This commit is contained in:
Houmgaor
2026-02-21 13:35:04 +01:00
parent 4fbc955774
commit 2757a5432f
4 changed files with 57 additions and 15 deletions

View File

@@ -58,8 +58,7 @@ func createTestServer() *Server {
sessions: make(map[net.Conn]*Session),
stages: make(map[string]*Stage),
semaphore: make(map[string]*Semaphore),
questCacheData: make(map[int][]byte),
questCacheTime: make(map[int]time.Time),
questCache: NewQuestCache(0),
erupeConfig: &cfg.Config{
DebugOptions: cfg.DebugOptions{
LogOutboundMessages: false,