3
0
mirror of https://github.com/ergochat/ergo.git synced 2025-01-03 08:32:43 +01:00

remove redundant friends computation

This commit is contained in:
Shivaram Lingamneni 2018-04-24 20:23:01 -04:00
parent b97ae00fe3
commit ef35c587fc

View File

@ -684,8 +684,6 @@ func (client *Client) destroy(beingResumed bool) {
// send quit/error message to client if they haven't been sent already // send quit/error message to client if they haven't been sent already
client.Quit("Connection closed") client.Quit("Connection closed")
friends := client.Friends()
friends.Remove(client)
if !beingResumed { if !beingResumed {
client.server.whoWas.Append(client) client.server.whoWas.Append(client)
} }
@ -703,6 +701,7 @@ func (client *Client) destroy(beingResumed bool) {
client.server.monitorManager.RemoveAll(client) client.server.monitorManager.RemoveAll(client)
// clean up channels // clean up channels
friends := make(ClientSet)
for _, channel := range client.Channels() { for _, channel := range client.Channels() {
if !beingResumed { if !beingResumed {
channel.Quit(client) channel.Quit(client)
@ -711,6 +710,7 @@ func (client *Client) destroy(beingResumed bool) {
friends.Add(member) friends.Add(member)
} }
} }
friends.Remove(client)
// clean up server // clean up server
if !beingResumed { if !beingResumed {