mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 13:29:27 +01:00
fix #848
This commit is contained in:
parent
4e733cc2b7
commit
d50c4c2bd6
@ -1185,9 +1185,11 @@ func (client *Client) destroy(session *Session) {
|
||||
|
||||
// should we destroy the whole client this time?
|
||||
// BRB is not respected if this is a destroy of the whole client (i.e., session == nil)
|
||||
brbEligible := session != nil && (brbState == BrbEnabled || alwaysOn)
|
||||
alreadyDestroyed := client.destroyed
|
||||
shouldDestroy := !alreadyDestroyed && remainingSessions == 0 && !brbEligible
|
||||
brbEligible := session != nil && brbState == BrbEnabled
|
||||
shouldDestroy := !client.destroyed && remainingSessions == 0 && !brbEligible && !alwaysOn
|
||||
// decrement stats on a true destroy, or for the removal of the last connected session
|
||||
// of an always-on client
|
||||
shouldDecrement := shouldDestroy || (alwaysOn && len(sessionsToDestroy) != 0 && len(client.sessions) == 0)
|
||||
if shouldDestroy {
|
||||
// if it's our job to destroy it, don't let anyone else try
|
||||
client.destroyed = true
|
||||
@ -1237,7 +1239,7 @@ func (client *Client) destroy(session *Session) {
|
||||
}
|
||||
|
||||
// decrement stats if we have no more sessions, even if the client will not be destroyed
|
||||
if shouldDestroy || (!alreadyDestroyed && remainingSessions == 0) {
|
||||
if shouldDecrement {
|
||||
invisible := client.HasMode(modes.Invisible)
|
||||
operator := client.HasMode(modes.LocalOperator) || client.HasMode(modes.Operator)
|
||||
client.server.stats.Remove(registered, invisible, operator)
|
||||
|
@ -179,8 +179,8 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
|
||||
return "", errNicknameInUse
|
||||
}
|
||||
if numSessions == 1 {
|
||||
invisible := client.HasMode(modes.Invisible)
|
||||
operator := client.HasMode(modes.Operator) || client.HasMode(modes.LocalOperator)
|
||||
invisible := currentClient.HasMode(modes.Invisible)
|
||||
operator := currentClient.HasMode(modes.Operator) || currentClient.HasMode(modes.LocalOperator)
|
||||
client.server.stats.AddRegistered(invisible, operator)
|
||||
}
|
||||
session.autoreplayMissedSince = lastSeen
|
||||
|
Loading…
Reference in New Issue
Block a user