GPCM: Send regular keep alive commands

This commit is contained in:
mkwcat
2024-02-06 20:45:26 -05:00
parent 886230a0c8
commit f429fb557e
2 changed files with 12 additions and 1 deletions

View File

@@ -306,7 +306,17 @@ func (g *GameSpySession) login(command common.GameSpyCommand) {
g.Conn.Write([]byte(payload))
// g.sendFriendRequests()
// Now start sending keep alive packets every 5 minutes
go func() {
for {
time.Sleep(5 * time.Minute)
if !g.LoggedIn {
return
}
g.Conn.Write([]byte(`\ka\\final\`))
}
}()
}
func (g *GameSpySession) exLogin(command common.GameSpyCommand) {

View File

@@ -122,6 +122,7 @@ func (g *GameSpySession) closeSession() {
g.Conn.Close()
if g.LoggedIn {
g.LoggedIn = false
delete(sessions, g.User.ProfileId)
}
}