3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-25 13:29:27 +01:00

fix a lock access in ResumeManager

This commit is contained in:
Shivaram Lingamneni 2019-05-19 05:47:41 -04:00
parent 8fc588375b
commit f10ed05f86

View File

@ -18,7 +18,7 @@ type resumeTokenPair struct {
}
type ResumeManager struct {
sync.RWMutex // level 2
sync.Mutex // level 2
resumeIDtoCreds map[string]resumeTokenPair
server *Server
@ -59,8 +59,8 @@ func (rm *ResumeManager) VerifyToken(token string) (client *Client) {
return
}
rm.RLock()
defer rm.RUnlock()
rm.Lock()
defer rm.Unlock()
id := token[:utils.SecretTokenLength]
pair, ok := rm.resumeIDtoCreds[id]