MCPcopy Create free account
hub / github.com/daodst/chat / deleteSession

Method deleteSession

clientapi/routing/register.go:114–131  ·  view source on GitHub ↗

deleteSession cleans up a given session, either because the registration completed successfully, or because a given timeout (default: 5min) was reached.

(sessionID string)

Source from the content-addressed store, hash-verified

112// deleteSession cleans up a given session, either because the registration completed
113// successfully, or because a given timeout (default: 5min) was reached.
114func (d *sessionsDict) deleteSession(sessionID string) {
115 d.Lock()
116 defer d.Unlock()
117 delete(d.params, sessionID)
118 delete(d.sessions, sessionID)
119 delete(d.deleteSessionToDeviceID, sessionID)
120 delete(d.sessionCompletedResult, sessionID)
121 // stop the timer, e.g. because the registration was completed
122 if t, ok := d.timer[sessionID]; ok {
123 if !t.Stop() {
124 select {
125 case <-t.C:
126 default:
127 }
128 }
129 delete(d.timer, sessionID)
130 }
131}
132
133func newSessionsDict() *sessionsDict {
134 return &sessionsDict{

Callers 3

startTimerMethod · 0.95
DeleteDeviceByIdFunction · 0.80
TestSessionCleanUpFunction · 0.80

Calls 3

LockMethod · 0.80
UnlockMethod · 0.80
StopMethod · 0.80

Tested by 1

TestSessionCleanUpFunction · 0.64