use context passed to .Connect() for the live of the relay.

This commit is contained in:
fiatjaf 2023-03-30 18:26:43 -03:00
parent e84a7936d5
commit 30e0e1040a
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1

View File

@ -73,7 +73,7 @@ func (r *Relay) String() string {
// Once successfully connected, context expiration has no effect: call r.Close
// to close the connection.
func (r *Relay) Connect(ctx context.Context) error {
connectionContext, cancel := context.WithCancel(context.Background())
connectionContext, cancel := context.WithCancel(ctx)
r.ConnectionContext = connectionContext
if r.URL == "" {