(userID uint)
| 295 | } |
| 296 | |
| 297 | func (s *Server) createSession(userID uint) *session { |
| 298 | s.mu.Lock() |
| 299 | defer s.mu.Unlock() |
| 300 | |
| 301 | now := time.Now() |
| 302 | s.pruneExpiredSessionsLocked(now) |
| 303 | return s.createSessionLocked(userID, ProtocolVersion, now) |
| 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)) |