From 5786367046724324be83567f4fafd4ec4d458c3d Mon Sep 17 00:00:00 2001 From: gammazero Date: Tue, 30 Jan 2024 03:11:54 -0800 Subject: [PATCH] Allow multiple calls to Publisher.Close without panic --- dagsync/ipnisync/publisher.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dagsync/ipnisync/publisher.go b/dagsync/ipnisync/publisher.go index f830474..76c7749 100644 --- a/dagsync/ipnisync/publisher.go +++ b/dagsync/ipnisync/publisher.go @@ -175,7 +175,9 @@ func (p *Publisher) SetRoot(c cid.Cid) { // Close closes the Publisher. func (p *Publisher) Close() error { if p.pubHost != nil { - return p.pubHost.Close() + err := p.pubHost.Close() + p.pubHost = nil + return err } return nil }