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

@ -452,11 +452,11 @@ func (client *Client) Realname() string {
func (client *Client) IsExpiredAlwaysOn(config *Config) (result bool) {
client.stateMutex.Lock()
defer client.stateMutex.Unlock()
return client.checkAlwaysOnExpirationNoMutex(config)
return client.checkAlwaysOnExpirationNoMutex(config, false)
}
func (client *Client) checkAlwaysOnExpirationNoMutex(config *Config) (result bool) {
if !(client.registered && client.alwaysOn) {
func (client *Client) checkAlwaysOnExpirationNoMutex(config *Config, ignoreRegistration bool) (result bool) {
if !((client.registered || ignoreRegistration) && client.alwaysOn) {
return false
}
deadline := time.Duration(config.Accounts.Multiclient.AlwaysOnExpiration)