MCPcopy
hub / github.com/tinode/chat / Shutdown

Method Shutdown

server/sessionstore.go:205–220  ·  view source on GitHub ↗

Shutdown terminates sessionStore. No need to clean up. Don't send to clustered sessions, their servers are not being shut down.

()

Source from the content-addressed store, hash-verified

203// Shutdown terminates sessionStore. No need to clean up.
204// Don't send to clustered sessions, their servers are not being shut down.
205func (ss *SessionStore) Shutdown() {
206 ss.lock.Lock()
207 defer ss.lock.Unlock()
208
209 shutdown := NoErrShutdown(types.TimeNow())
210 for _, s := range ss.sessCache {
211 if !s.isMultiplex() {
212 _, data := s.serialize(shutdown)
213 s.stopSession(data)
214 }
215 }
216
217 // TODO: Consider broadcasting shutdown to other cluster nodes.
218
219 logs.Info.Println("SessionStore shut down, sessions terminated:", len(ss.sessCache))
220}
221
222// EvictUser terminates all sessions of a given user.
223func (ss *SessionStore) EvictUser(uid types.Uid, skipSid string) {

Callers 1

listenAndServeFunction · 0.80

Calls 8

TimeNowFunction · 0.92
NoErrShutdownFunction · 0.85
LockMethod · 0.80
UnlockMethod · 0.80
isMultiplexMethod · 0.80
serializeMethod · 0.80
stopSessionMethod · 0.80
PrintlnMethod · 0.80

Tested by

no test coverage detected