Use shutdownCtx for dcrdWithNotifs
This commit is contained in:
parent
f06d4cd8ba
commit
c82b08b760
@ -279,7 +279,7 @@ func (n *NotificationHandler) Close() error {
|
|||||||
func connectNotifier(shutdownCtx context.Context, dcrdWithNotifs rpc.DcrdConnect) error {
|
func connectNotifier(shutdownCtx context.Context, dcrdWithNotifs rpc.DcrdConnect) error {
|
||||||
notifierClosed = make(chan struct{})
|
notifierClosed = make(chan struct{})
|
||||||
|
|
||||||
dcrdClient, err := dcrdWithNotifs.Client(context.Background(), netParams)
|
dcrdClient, err := dcrdWithNotifs.Client(shutdownCtx, netParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -295,6 +295,9 @@ func connectNotifier(shutdownCtx context.Context, dcrdWithNotifs rpc.DcrdConnect
|
|||||||
// notifier is closed.
|
// notifier is closed.
|
||||||
select {
|
select {
|
||||||
case <-shutdownCtx.Done():
|
case <-shutdownCtx.Done():
|
||||||
|
// A shutdown signal has been received - close the client with the
|
||||||
|
// notification handler to prevent further notifications from being
|
||||||
|
// received.
|
||||||
dcrdWithNotifs.Close()
|
dcrdWithNotifs.Close()
|
||||||
return nil
|
return nil
|
||||||
case <-notifierClosed:
|
case <-notifierClosed:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user