mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
simplify "client dead" logic in AddSession
now that we have client.destroyed again, we don't need to test the "0 sessions && brb disabled" condition in both AddSession() and destroy()
This commit is contained in:
parent
5ac7ea5b1c
commit
b134a63dc2
@ -97,15 +97,9 @@ func (client *Client) AddSession(session *Session) (success bool) {
|
||||
defer client.stateMutex.Unlock()
|
||||
|
||||
// client may be dying and ineligible to receive another session
|
||||
switch client.brbTimer.state {
|
||||
case BrbDisabled:
|
||||
if len(client.sessions) == 0 {
|
||||
if client.destroyed {
|
||||
return false
|
||||
}
|
||||
case BrbDead:
|
||||
return false
|
||||
// default: BrbEnabled or BrbSticky, proceed
|
||||
}
|
||||
// success, attach the new session to the client
|
||||
session.client = client
|
||||
client.sessions = append(client.sessions, session)
|
||||
|
Loading…
Reference in New Issue
Block a user