[#1548] morph/client: Execute close callback without switch mutex

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-06-27 14:23:44 +03:00
parent 7b5b735fb2
commit b193352d1e

View file

@ -579,10 +579,9 @@ func (c *Client) NotificationChannel() <-chan client.Notification {
// - inactiveModeCb is called if not nil. // - inactiveModeCb is called if not nil.
func (c *Client) inactiveMode() { func (c *Client) inactiveMode() {
c.switchLock.Lock() c.switchLock.Lock()
defer c.switchLock.Unlock()
close(c.notifications) close(c.notifications)
c.inactive = true c.inactive = true
c.switchLock.Unlock()
if c.cfg.inactiveModeCb != nil { if c.cfg.inactiveModeCb != nil {
c.cfg.inactiveModeCb() c.cfg.inactiveModeCb()