small bug fix

This commit is contained in:
ston1th 2018-01-17 22:42:11 +01:00
commit 8e361f3156

View file

@ -28,21 +28,21 @@ func NewMemBlacklist() *MemBlacklist {
} }
// Add adds a new token signature with expiration time to the blacklist // Add adds a new token signature with expiration time to the blacklist
func (mb MemBlacklist) Add(sig string, exp int64) { func (mb *MemBlacklist) Add(sig string, exp int64) {
mb.Lock() mb.Lock()
mb.list[sig] = exp mb.list[sig] = exp
mb.Unlock() mb.Unlock()
} }
// Remove deletes a token signature from the blacklist // Remove deletes a token signature from the blacklist
func (mb MemBlacklist) Remove(sig string) { func (mb *MemBlacklist) Remove(sig string) {
mb.Lock() mb.Lock()
delete(mb.list, sig) delete(mb.list, sig)
mb.Unlock() mb.Unlock()
} }
// Check returns true if a token signature is blacklisted and false otherwise // Check returns true if a token signature is blacklisted and false otherwise
func (mb MemBlacklist) Check(sig string) (ok bool) { func (mb *MemBlacklist) Check(sig string) (ok bool) {
mb.RLock() mb.RLock()
_, ok = mb.list[sig] _, ok = mb.list[sig]
mb.RUnlock() mb.RUnlock()
@ -50,7 +50,7 @@ func (mb MemBlacklist) Check(sig string) (ok bool) {
} }
// Map returns the blacklist in the form of a iterable map structure for cleanup // Map returns the blacklist in the form of a iterable map structure for cleanup
func (mb MemBlacklist) Map() (list BlacklistMap) { func (mb *MemBlacklist) Map() (list BlacklistMap) {
list = make(BlacklistMap) list = make(BlacklistMap)
mb.RLock() mb.RLock()
for k, v := range mb.list { for k, v := range mb.list {