3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 18:52:41 +01:00
This commit is contained in:
Shivaram Lingamneni 2020-02-25 13:26:49 -05:00
parent ec1a718275
commit ce208cb3e1

View File

@ -54,22 +54,18 @@ func (cmd *Command) Run(server *Server, client *Client, session *Session, msg ir
return cmd.handler(server, client, msg, rb) return cmd.handler(server, client, msg, rb)
}() }()
// after each command, see if we can send registration to the client
if !exiting && !client.registered {
exiting = server.tryRegister(client, session)
}
// most servers do this only for PING/PONG, but we'll do it for any command: // most servers do this only for PING/PONG, but we'll do it for any command:
if client.registered { if client.registered {
// touch even if `exiting`, so we record the time of a QUIT accurately // touch even if `exiting`, so we record the time of a QUIT accurately
session.idletimer.Touch() session.idletimer.Touch()
} }
if exiting { if !exiting && client.registered && !cmd.leaveClientIdle {
return
}
// after each command, see if we can send registration to the client
if !client.registered {
exiting = server.tryRegister(client, session)
}
if client.registered && !cmd.leaveClientIdle {
client.Active(session) client.Active(session)
} }