summaryrefslogtreecommitdiffhomepage
path: root/control/controlhttp/client.go
diff options
context:
space:
mode:
Diffstat (limited to 'control/controlhttp/client.go')
-rw-r--r--control/controlhttp/client.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/control/controlhttp/client.go b/control/controlhttp/client.go
index e01cb1f9a..522318c0e 100644
--- a/control/controlhttp/client.go
+++ b/control/controlhttp/client.go
@@ -310,6 +310,21 @@ func (a *Dialer) dialHost(ctx context.Context, addr netip.Addr) (*ClientConn, er
if debugNoiseDial() {
a.logf("noise dial (%v, %v) = (%v, %v)", u, addr, cbConn, err)
}
+
+ // We've seen some networks where the connection upgrades
+ // successfully, but then fails when we make a request after
+ // the upgrade. Work around this by making a request over the
+ // now-upgraded connection before we tell the outer function
+ // that we've got a connection.
+ if err == nil && a.TestConn != nil {
+ err = a.TestConn(cbConn)
+ if err != nil {
+ // Close and don't leak the connection.
+ cbConn.Close()
+ cbConn = nil
+ }
+ }
+
select {
case ch <- tryURLRes{u, cbConn, err}:
case <-ctx.Done():