mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-30 10:48:10 -07: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:
+1
-7
@@ -97,14 +97,8 @@ func (client *Client) AddSession(session *Session) (success bool) {
|
|||||||
defer client.stateMutex.Unlock()
|
defer client.stateMutex.Unlock()
|
||||||
|
|
||||||
// client may be dying and ineligible to receive another session
|
// client may be dying and ineligible to receive another session
|
||||||
switch client.brbTimer.state {
|
if client.destroyed {
|
||||||
case BrbDisabled:
|
|
||||||
if len(client.sessions) == 0 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
case BrbDead:
|
|
||||||
return false
|
return false
|
||||||
// default: BrbEnabled or BrbSticky, proceed
|
|
||||||
}
|
}
|
||||||
// success, attach the new session to the client
|
// success, attach the new session to the client
|
||||||
session.client = client
|
session.client = client
|
||||||
|
|||||||
Reference in New Issue
Block a user