MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / getSession

Method getSession

server/mcp/handler.go:338–355  ·  view source on GitHub ↗
(id string)

Source from the content-addressed store, hash-verified

336}
337
338func (s *Server) getSession(id string) (session, bool) {
339 if id == "" {
340 return session{}, false
341 }
342 s.mu.Lock()
343 defer s.mu.Unlock()
344 currentSession, ok := s.sessions[id]
345 if !ok || currentSession == nil {
346 return session{}, false
347 }
348 now := time.Now()
349 if sessionExpired(currentSession, now) {
350 delete(s.sessions, id)
351 return session{}, false
352 }
353 currentSession.lastUsedAt = now
354 return *currentSession, true
355}
356
357func (s *Server) markSessionInitialized(id string) bool {
358 s.mu.Lock()

Callers 4

handlePostMethod · 0.95
handleDeleteMethod · 0.95
TestDeleteRemovesSessionFunction · 0.80

Calls 3

sessionExpiredFunction · 0.85
UnlockMethod · 0.65
NowMethod · 0.65

Tested by 2

TestDeleteRemovesSessionFunction · 0.64