From 9c692af624c9e4d8ed7cc1f27734804af956c215 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Wed, 16 Oct 2024 16:27:50 -0300 Subject: [PATCH] I think this handles CLOSED messages better. --- subscription.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subscription.go b/subscription.go index 211e89e..d4c1af4 100644 --- a/subscription.go +++ b/subscription.go @@ -110,9 +110,9 @@ func (sub *Subscription) dispatchEose() { func (sub *Subscription) handleClosed(reason string) { go func() { sub.ClosedReason <- reason + sub.live.Store(false) // set this so we don't send an unnecessary CLOSE to the relay + sub.Unsub() }() - sub.live.Store(false) // set this so we don't send an unnecessary CLOSE to the relay - sub.Unsub() } // Unsub closes the subscription, sending "CLOSE" to relay as in NIP-01.