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

Method initializeSession

server/mcp/handler.go:256–273  ·  view source on GitHub ↗
(userID uint, requestedID string, protocolVersion string)

Source from the content-addressed store, hash-verified

254}
255
256func (s *Server) initializeSession(userID uint, requestedID string, protocolVersion string) *session {
257 s.mu.Lock()
258 defer s.mu.Unlock()
259
260 now := time.Now()
261 s.pruneExpiredSessionsLocked(now)
262 if requestedID != "" {
263 currentSession, ok := s.sessions[requestedID]
264 if ok && currentSession != nil && currentSession.userID == userID {
265 currentSession.initialized = false
266 currentSession.protocolVersion = protocolVersion
267 currentSession.lastUsedAt = now
268 return currentSession
269 }
270 }
271
272 return s.createSessionLocked(userID, protocolVersion, now)
273}
274
275func (s *Server) handleDelete(c *gin.Context) {
276 if !validateOrigin(c.Request) {

Callers 1

handleInitializeMethod · 0.95

Calls 4

createSessionLockedMethod · 0.95
UnlockMethod · 0.65
NowMethod · 0.65

Tested by

no test coverage detected