mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-26 13:59:44 +01:00
Merge pull request #1486 from slingamn/alwayson_expiration_followup
fix always-on expiration checks
This commit is contained in:
commit
096b2df41c
@ -443,7 +443,7 @@ func (server *Server) AddAlwaysOnClient(account ClientAccount, channelToModes ma
|
|||||||
nextSessionID: 1,
|
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)
|
server.logger.Debug("accounts", "always-on client not created due to expiration", account.Name)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1403,7 +1403,7 @@ func (client *Client) destroy(session *Session) {
|
|||||||
alwaysOn := registered && client.alwaysOn
|
alwaysOn := registered && client.alwaysOn
|
||||||
// if we hit always-on-expiration, confirm the expiration and then proceed as though
|
// if we hit always-on-expiration, confirm the expiration and then proceed as though
|
||||||
// always-on is disabled:
|
// 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"
|
quitMessage = "Timed out due to inactivity"
|
||||||
alwaysOn = false
|
alwaysOn = false
|
||||||
client.alwaysOn = false
|
client.alwaysOn = false
|
||||||
|
@ -452,11 +452,11 @@ func (client *Client) Realname() string {
|
|||||||
func (client *Client) IsExpiredAlwaysOn(config *Config) (result bool) {
|
func (client *Client) IsExpiredAlwaysOn(config *Config) (result bool) {
|
||||||
client.stateMutex.Lock()
|
client.stateMutex.Lock()
|
||||||
defer client.stateMutex.Unlock()
|
defer client.stateMutex.Unlock()
|
||||||
return client.checkAlwaysOnExpirationNoMutex(config)
|
return client.checkAlwaysOnExpirationNoMutex(config, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (client *Client) checkAlwaysOnExpirationNoMutex(config *Config) (result bool) {
|
func (client *Client) checkAlwaysOnExpirationNoMutex(config *Config, ignoreRegistration bool) (result bool) {
|
||||||
if !(client.registered && client.alwaysOn) {
|
if !((client.registered || ignoreRegistration) && client.alwaysOn) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
deadline := time.Duration(config.Accounts.Multiclient.AlwaysOnExpiration)
|
deadline := time.Duration(config.Accounts.Multiclient.AlwaysOnExpiration)
|
||||||
|
Loading…
Reference in New Issue
Block a user