another last guard against sending on closed channel.

This commit is contained in:
fiatjaf
2026-03-02 11:59:12 -03:00
parent 4dab261bdf
commit 23d525f067
+4
View File
@@ -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))