Ensure invalidateTokenImmediately acquires mutex

This commit is contained in:
David Robertson 2023-11-02 13:53:44 +00:00
parent 0e8d4a8e47
commit 5e65210cc4
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD

View File

@ -99,8 +99,10 @@ func (s *testV2Server) addAccountWithDeviceID(userID, deviceID, token string) {
// like invalidateToken, but doesn't do any waiting. // like invalidateToken, but doesn't do any waiting.
func (s *testV2Server) invalidateTokenImmediately(token string) { func (s *testV2Server) invalidateTokenImmediately(token string) {
s.mu.Lock()
delete(s.tokenToUser, token) delete(s.tokenToUser, token)
delete(s.tokenToDevice, token) delete(s.tokenToDevice, token)
s.mu.Unlock()
} }
// remove the token and wait until the proxy sends a request with this token, then 401 it and return. // remove the token and wait until the proxy sends a request with this token, then 401 it and return.