Write returns an error in a channel (why? I think it makes no difference.)

This commit is contained in:
fiatjaf
2023-06-22 10:46:31 -03:00
parent f78270765d
commit f0a35d7ab2
2 changed files with 5 additions and 5 deletions

View File

@@ -88,7 +88,7 @@ func (sub *Subscription) Fire() error {
debugLog("{%s} sending %v", sub.Relay.URL, reqb)
sub.live = true
if err := sub.Relay.Write(reqb); err != nil {
if err := <-sub.Relay.Write(reqb); err != nil {
sub.cancel()
return fmt.Errorf("failed to write: %w", err)
}