mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-12 15:04:38 +01:00
prevent concurrent map write to questCache
This commit is contained in:
@@ -238,8 +238,10 @@ func loadQuestFile(s *Session, questId int) []byte {
|
|||||||
}
|
}
|
||||||
questBody.WriteBytes(newStrings.Data())
|
questBody.WriteBytes(newStrings.Data())
|
||||||
|
|
||||||
|
s.server.questCacheLock.Lock()
|
||||||
s.server.questCacheData[questId] = questBody.Data()
|
s.server.questCacheData[questId] = questBody.Data()
|
||||||
s.server.questCacheTime[questId] = time.Now()
|
s.server.questCacheTime[questId] = time.Now()
|
||||||
|
s.server.questCacheLock.Unlock()
|
||||||
return questBody.Data()
|
return questBody.Data()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ type Server struct {
|
|||||||
|
|
||||||
raviente *Raviente
|
raviente *Raviente
|
||||||
|
|
||||||
|
questCacheLock sync.RWMutex
|
||||||
questCacheData map[int][]byte
|
questCacheData map[int][]byte
|
||||||
questCacheTime map[int]time.Time
|
questCacheTime map[int]time.Time
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user