(userID uint, protocolVersion string, now time.Time)
| 304 | } |
| 305 | |
| 306 | func (s *Server) createSessionLocked(userID uint, protocolVersion string, now time.Time) *session { |
| 307 | s.pruneLeastRecentlyUsedUserSessionsLocked(userID, max(0, s.countUserSessionsLocked(userID)-maxUserSessions+1)) |
| 308 | s.pruneLeastRecentlyUsedSessionsLocked(max(0, len(s.sessions)-maxSessions+1)) |
| 309 | currentSession := &session{ |
| 310 | id: random.Token(), |
| 311 | userID: userID, |
| 312 | protocolVersion: protocolVersion, |
| 313 | createdAt: now, |
| 314 | lastUsedAt: now, |
| 315 | } |
| 316 | s.sessions[currentSession.id] = currentSession |
| 317 | return currentSession |
| 318 | } |
| 319 | |
| 320 | func (s *Server) validateRequestProtocolVersion(requestedVersion string, negotiatedVersion string) bool { |
| 321 | if requestedVersion == "" { |
no test coverage detected