From 23d525f0673eb481c166ab18f28bd758e1e385f5 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 2 Mar 2026 11:59:12 -0300 Subject: [PATCH] another last guard against sending on closed channel. --- relay.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/relay.go b/relay.go index a56e42d..b1c4cfb 100644 --- a/relay.go +++ b/relay.go @@ -474,6 +474,10 @@ func (r *Relay) WriteWithError(msg []byte) error { defer r.closeMutex.Unlock() + if r.writeQueue != nil { + return nil + } + select { case <-r.connectionContext.Done(): return fmt.Errorf("failed to write to %s: %w", r.URL, context.Cause(r.connectionContext))