X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=lib%2Fxdsserver%2Fsessions.go;h=0c16b995ec10fa5b12efc48c79e6fd4d5b2963b1;hb=HEAD;hp=61f2f261ef28d7b9d4820abef450c91e3398ea0e;hpb=9fb41a3693eeaac9adea71112232abaafea54c8f;p=src%2Fxds%2Fxds-server.git diff --git a/lib/xdsserver/sessions.go b/lib/xdsserver/sessions.go index 61f2f26..0c16b99 100644 --- a/lib/xdsserver/sessions.go +++ b/lib/xdsserver/sessions.go @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 "IoT.bzh" + * Copyright (C) 2017-2018 "IoT.bzh" * Author Sebastien Douheret * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,7 @@ import ( "time" "github.com/gin-gonic/gin" - "github.com/googollee/go-socket.io" + socketio "github.com/googollee/go-socket.io" uuid "github.com/satori/go.uuid" "github.com/syncthing/syncthing/lib/sync" ) @@ -59,8 +59,8 @@ type Sessions struct { stop chan struct{} // signals intentional stop } -// NewClientSessions . -func NewClientSessions(ctx *Context, cookieMaxAge string) *Sessions { +// ClientSessionsConstructor . +func ClientSessionsConstructor(ctx *Context, cookieMaxAge string) *Sessions { ckMaxAge, err := strconv.ParseInt(cookieMaxAge, 10, 0) if err != nil { ckMaxAge = 0 @@ -217,10 +217,8 @@ func (s *Sessions) monitorSessMap() { s.Log.Debugln("Stop monitorSessMap") return case <-time.After(sessionMonitorTime * time.Second): - if s.LogLevelSilly { - s.Log.Debugf("Sessions Map size: %d", len(s.sessMap)) - s.Log.Debugf("Sessions Map : %v", s.sessMap) - } + s.LogSillyf("Sessions Map size: %d", len(s.sessMap)) + s.LogSillyf("Sessions Map : %v", s.sessMap) if len(s.sessMap) > maxSessions { s.Log.Errorln("TOO MUCH sessions, cleanup old ones !") @@ -228,7 +226,7 @@ func (s *Sessions) monitorSessMap() { s.mutex.Lock() for _, ss := range s.sessMap { - if ss.expireAt.Sub(time.Now()) < 0 { + if ss.expireAt.Sub(time.Now()) <= 0 { s.Log.Debugf("Delete expired session id: %s", ss.ID) delete(s.sessMap, ss.ID) }