(userID uint, requestedID string, protocolVersion string)
| 254 | } |
| 255 | |
| 256 | func (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 | |
| 275 | func (s *Server) handleDelete(c *gin.Context) { |
| 276 | if !validateOrigin(c.Request) { |
no test coverage detected