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

Method cleanUp

server/session.go:412–428  ·  view source on GitHub ↗

cleanUp is called when the session is terminated to perform resource cleanup.

(expired bool)

Source from the content-addressed store, hash-verified

410
411// cleanUp is called when the session is terminated to perform resource cleanup.
412func (s *Session) cleanUp(expired bool) {
413 atomic.StoreInt32(&s.terminating, 1)
414 s.purgeChannels()
415 s.inflightReqs.Wait()
416 s.inflightReqs = nil
417 if !expired {
418 s.sessionStoreLock.Lock()
419 globals.sessionStore.Delete(s)
420 s.sessionStoreLock.Unlock()
421 }
422
423 s.background = false
424 s.bkgTimer.Stop()
425 s.unsubAll()
426 // Stop the write loop.
427 s.stopSession(nil)
428}
429
430// Message received, convert bytes to ClientComMessage and dispatch
431func (s *Session) dispatchRaw(raw []byte) {

Callers 3

MessageLoopMethod · 0.95
readLoopMethod · 0.95
NewSessionMethod · 0.80

Calls 8

purgeChannelsMethod · 0.95
unsubAllMethod · 0.95
stopSessionMethod · 0.95
WaitMethod · 0.80
LockMethod · 0.80
UnlockMethod · 0.80
DeleteMethod · 0.65
StopMethod · 0.65

Tested by

no test coverage detected