Browse Source

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()
tags/v1.1.0-rc1
Shivaram Lingamneni 5 years ago
parent
commit
b134a63dc2
1 changed files with 1 additions and 7 deletions
  1. 1
    7
      irc/getters.go

+ 1
- 7
irc/getters.go View File

@@ -97,14 +97,8 @@ func (client *Client) AddSession(session *Session) (success bool) {
97 97
 	defer client.stateMutex.Unlock()
98 98
 
99 99
 	// client may be dying and ineligible to receive another session
100
-	switch client.brbTimer.state {
101
-	case BrbDisabled:
102
-		if len(client.sessions) == 0 {
103
-			return false
104
-		}
105
-	case BrbDead:
100
+	if client.destroyed {
106 101
 		return false
107
-		// default: BrbEnabled or BrbSticky, proceed
108 102
 	}
109 103
 	// success, attach the new session to the client
110 104
 	session.client = client

Loading…
Cancel
Save