NodeRestarted removes stale sessions from a restarted cluster node. - nodeName is the name of affected node - fingerprint is the new fingerprint of the node.
(nodeName string, fingerprint int64)
| 245 | // - nodeName is the name of affected node |
| 246 | // - fingerprint is the new fingerprint of the node. |
| 247 | func (ss *SessionStore) NodeRestarted(nodeName string, fingerprint int64) { |
| 248 | ss.lock.Lock() |
| 249 | defer ss.lock.Unlock() |
| 250 | |
| 251 | for _, s := range ss.sessCache { |
| 252 | if !s.isMultiplex() || s.clnode.name != nodeName { |
| 253 | continue |
| 254 | } |
| 255 | if s.clnode.fingerprint != fingerprint { |
| 256 | s.stopSession(nil) |
| 257 | delete(ss.sessCache, s.sid) |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | statsSet("LiveSessions", int64(len(ss.sessCache))) |
| 262 | } |
| 263 | |
| 264 | // NewSessionStore initializes a session store. |
| 265 | func NewSessionStore(lifetime time.Duration) *SessionStore { |
nothing calls this directly
no test coverage detected