afterRelease prunes the session index when sid no longer holds any lock on key, and drops the set when it empties. Only sid's presence can have changed, since a release only removes sid's locks.
(key string, s *Set, sid uint64)
| 219 | // and drops the set when it empties. Only sid's presence can have changed, since |
| 220 | // a release only removes sid's locks. |
| 221 | func (m *Manager) afterRelease(key string, s *Set, sid uint64) { |
| 222 | if s.Empty() { |
| 223 | delete(m.byKey, key) |
| 224 | m.deindex(sid, key) |
| 225 | return |
| 226 | } |
| 227 | if !setHasSession(s, sid) { |
| 228 | m.deindex(sid, key) |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | func (m *Manager) index(sid uint64, key string) { |
| 233 | keys := m.bySid[sid] |
no test coverage detected