From b134a63dc28d62a986ffbe882c15b0f2a89bc040 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Tue, 28 May 2019 04:56:56 -0400 Subject: [PATCH] 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() --- irc/getters.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/irc/getters.go b/irc/getters.go index 91187cc1..c6a0d208 100644 --- a/irc/getters.go +++ b/irc/getters.go @@ -97,14 +97,8 @@ 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 { - return false - } - case BrbDead: + if client.destroyed { return false - // default: BrbEnabled or BrbSticky, proceed } // success, attach the new session to the client session.client = client