address closeMutex deadlock by canceling the relay connection context on doClose().

This commit is contained in:
fiatjaf
2025-08-23 09:54:36 -03:00
parent c2635c1f20
commit 69c0981b51
2 changed files with 8 additions and 3 deletions

View File

@@ -118,7 +118,7 @@ func (r *Relay) ConnectWithTLS(ctx context.Context, tlsConfig *tls.Config) error
return fmt.Errorf("invalid relay URL '%s'", r.URL)
}
conn, err := newConnection(ctx, r.URL, r.handleMessage, r.requestHeader, tlsConfig)
conn, err := newConnection(ctx, r.connectionContextCancel, r.URL, r.handleMessage, r.requestHeader, tlsConfig)
if err != nil {
return fmt.Errorf("error opening websocket to '%s': %w", r.URL, err)
}