1
0
Fork 0
forked from External/ergo

fix always-on expiration checks

checkAlwaysOnExpirationNoMutex was respecting registered status, but
always-on clients were not considered registered at the time of the
initial check, so they were being created regardless of expiration.
This commit is contained in:
Shivaram Lingamneni 2021-01-15 06:50:35 -05:00
parent 7b300a802f
commit 6b7f0e15ac
2 changed files with 5 additions and 5 deletions

View file

@ -443,7 +443,7 @@ func (server *Server) AddAlwaysOnClient(account ClientAccount, channelToModes ma
nextSessionID: 1,
}
if client.checkAlwaysOnExpirationNoMutex(config) {
if client.checkAlwaysOnExpirationNoMutex(config, true) {
server.logger.Debug("accounts", "always-on client not created due to expiration", account.Name)
return
}
@ -1403,7 +1403,7 @@ func (client *Client) destroy(session *Session) {
alwaysOn := registered && client.alwaysOn
// if we hit always-on-expiration, confirm the expiration and then proceed as though
// always-on is disabled:
if alwaysOn && session == nil && client.checkAlwaysOnExpirationNoMutex(config) {
if alwaysOn && session == nil && client.checkAlwaysOnExpirationNoMutex(config, false) {
quitMessage = "Timed out due to inactivity"
alwaysOn = false
client.alwaysOn = false