mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-13 15:34:38 +01:00
fix invalidateSessions
This commit is contained in:
@@ -280,13 +280,18 @@ func (s *Server) manageSessions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) invalidateSessions() {
|
func (s *Server) invalidateSessions() {
|
||||||
for _, session := range s.sessions {
|
for {
|
||||||
if time.Now().Add(-30 * time.Second).After(session.lastPacket) {
|
if s.isShuttingDown {
|
||||||
s.logger.Info("Session timeout", zap.String("Name", session.Name))
|
break
|
||||||
logoutPlayer(session)
|
|
||||||
}
|
}
|
||||||
|
for _, sess := range s.sessions {
|
||||||
|
if time.Now().Sub(sess.lastPacket) > time.Second*time.Duration(30) {
|
||||||
|
s.logger.Info("session timeout", zap.String("Name", sess.Name))
|
||||||
|
logoutPlayer(sess)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
time.Sleep(time.Second * 10)
|
||||||
}
|
}
|
||||||
time.Sleep(30 * time.Second)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// BroadcastMHF queues a MHFPacket to be sent to all sessions.
|
// BroadcastMHF queues a MHFPacket to be sent to all sessions.
|
||||||
|
|||||||
Reference in New Issue
Block a user