From 36f346c0fe15c03f62359cd69264620fa546bd2c Mon Sep 17 00:00:00 2001 From: Viktor Liu Date: Thu, 4 Jun 2026 13:18:23 +0200 Subject: [PATCH] Log skipped relay fallback and bail sequential dial on cancelled context --- shared/relay/client/client.go | 3 +++ shared/relay/client/dialer/race_dialer.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/shared/relay/client/client.go b/shared/relay/client/client.go index acc5fee0a..c851ab329 100644 --- a/shared/relay/client/client.go +++ b/shared/relay/client/client.go @@ -681,6 +681,9 @@ func (c *Client) onDatagramTooLarge(conn net.Conn, cause error) { // Without the shared tracker a reconnect would just race QUIC again and // re-fail, so leave the connection up rather than loop. if c.transportFallback == nil { + if c.datagramFallbackTriggered.CompareAndSwap(false, true) { + c.log.Debugf("%s, but no transport fallback configured, leaving connection up", cause) + } return } diff --git a/shared/relay/client/dialer/race_dialer.go b/shared/relay/client/dialer/race_dialer.go index 16641f6d0..aef1ef464 100644 --- a/shared/relay/client/dialer/race_dialer.go +++ b/shared/relay/client/dialer/race_dialer.go @@ -91,6 +91,9 @@ func (r *RaceDial) Dial(ctx context.Context) (net.Conn, error) { // falling back to the next on failure. func (r *RaceDial) dialSequential(ctx context.Context) (net.Conn, error) { for _, dfn := range r.dialerFns { + if err := ctx.Err(); err != nil { + return nil, err + } attemptCtx, cancel := context.WithTimeout(ctx, r.connectionTimeout) r.log.Infof("dialing Relay server via %s", dfn.Protocol()) conn, err := dfn.Dial(attemptCtx, r.serverURL, r.serverName)