From 68d370af19024662fa90671e4c98eaf956294182 Mon Sep 17 00:00:00 2001 From: Sudarsan Reddy Date: Thu, 11 Aug 2022 18:53:27 +0100 Subject: [PATCH] TUN-6617: Dont fallback to http2 if QUIC conn was successful. cloudflared falls back aggressively to HTTP/2 protocol if a connection attempt with QUIC failed. This was done to ensure that machines with UDP egress disabled did not stop clients from connecting to the cloudlfare edge. This PR improves on that experience by having cloudflared remember if a QUIC connection was successful which implies UDP egress works. In this case, cloudflared does not fallback to HTTP/2 and keeps trying to connect to the edge with QUIC. --- component-tests/util.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/component-tests/util.py b/component-tests/util.py index aae9b85f..6e60d08e 100644 --- a/component-tests/util.py +++ b/component-tests/util.py @@ -61,13 +61,15 @@ def cloudflared_cmd(config, config_path, cfd_args, cfd_pre_args, root): def run_cloudflared_background(cmd, allow_input, capture_output): output = subprocess.PIPE if capture_output else subprocess.DEVNULL stdin = subprocess.PIPE if allow_input else None + cfd = None try: cfd = subprocess.Popen(cmd, stdin=stdin, stdout=output, stderr=output) yield cfd finally: - cfd.terminate() - if capture_output: - LOGGER.info(f"cloudflared log: {cfd.stderr.read()}") + if cfd: + cfd.terminate() + if capture_output: + LOGGER.info(f"cloudflared log: {cfd.stderr.read()}") def wait_tunnel_ready(tunnel_url=None, require_min_connections=1, cfd_logs=None):