forked from TrueCloudLab/frostfs-node
[#1170] pkg/morph: Add inactive mode callback
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
424cc6d495
commit
2427593da6
2 changed files with 25 additions and 3 deletions
|
@ -543,10 +543,16 @@ func (c *Client) NotificationChannel() <-chan client.Notification {
|
|||
|
||||
// inactiveMode switches Client to an inactive mode:
|
||||
// - notification channel is closed;
|
||||
// - all the new RPC request would return ErrConnectionLost.
|
||||
//
|
||||
// Note: must be called only with held write switchLock.
|
||||
// - all the new RPC request would return ErrConnectionLost;
|
||||
// - inactiveModeCb is called if not nil.
|
||||
func (c *Client) inactiveMode() {
|
||||
c.switchLock.Lock()
|
||||
defer c.switchLock.Unlock()
|
||||
|
||||
close(c.notifications)
|
||||
c.inactive = true
|
||||
|
||||
if c.cfg.inactiveModeCb != nil {
|
||||
c.cfg.inactiveModeCb()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue