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))