From 90b428b416d06c76d25d94a753c4f6d9612238b4 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Sun, 12 Jan 2020 11:20:30 -0500 Subject: [PATCH] fix #745 --- irc/channelmanager.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/irc/channelmanager.go b/irc/channelmanager.go index 9a22a5da..dc711e55 100644 --- a/irc/channelmanager.go +++ b/irc/channelmanager.go @@ -214,6 +214,9 @@ func (cm *ChannelManager) SetRegistered(channelName string, account string) (err return err } cm.registeredChannels.Add(cfname) + if skel, err := Skeleton(channel.Name()); err == nil { + cm.registeredSkeletons.Add(skel) + } return nil } @@ -243,6 +246,9 @@ func (cm *ChannelManager) SetUnregistered(channelName string, account string) (e } entry.channel.SetUnregistered(account) delete(cm.registeredChannels, cfname) + if skel, err := Skeleton(entry.channel.Name()); err == nil { + delete(cm.registeredSkeletons, skel) + } return nil } @@ -350,9 +356,9 @@ func (cm *ChannelManager) IsPurged(chname string) (result bool) { return false } - cm.Lock() + cm.RLock() result = cm.purgedChannels.Has(chname) - cm.Unlock() + cm.RUnlock() return }