From c82b08b76027aa8d9aecb4517d80afbc5e43f3b3 Mon Sep 17 00:00:00 2001 From: jholdstock Date: Mon, 21 Sep 2020 11:17:31 +0100 Subject: [PATCH] Use shutdownCtx for dcrdWithNotifs --- background/background.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/background/background.go b/background/background.go index 148d496..c601747 100644 --- a/background/background.go +++ b/background/background.go @@ -279,7 +279,7 @@ func (n *NotificationHandler) Close() error { func connectNotifier(shutdownCtx context.Context, dcrdWithNotifs rpc.DcrdConnect) error { notifierClosed = make(chan struct{}) - dcrdClient, err := dcrdWithNotifs.Client(context.Background(), netParams) + dcrdClient, err := dcrdWithNotifs.Client(shutdownCtx, netParams) if err != nil { return err } @@ -295,6 +295,9 @@ func connectNotifier(shutdownCtx context.Context, dcrdWithNotifs rpc.DcrdConnect // notifier is closed. select { 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() return nil case <-notifierClosed: