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

Method Get

server/sessionstore.go:163–177  ·  view source on GitHub ↗

Get fetches a session from store by session ID.

(sid string)

Source from the content-addressed store, hash-verified

161
162// Get fetches a session from store by session ID.
163func (ss *SessionStore) Get(sid string) *Session {
164 ss.lock.Lock()
165 defer ss.lock.Unlock()
166
167 if sess := ss.sessCache[sid]; sess != nil {
168 if sess.proto == LPOLL {
169 ss.lru.MoveToFront(sess.lpTracker)
170 sess.lastTouched = time.Now()
171 }
172
173 return sess
174 }
175
176 return nil
177}
178
179// Delete removes session from store.
180func (ss *SessionStore) Delete(s *Session) {

Callers

nothing calls this directly

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected