From 32df01a9da79cf05b286a2da408fcfe664914334 Mon Sep 17 00:00:00 2001 From: Adam Chalmers Date: Thu, 19 Mar 2020 17:48:42 -0500 Subject: [PATCH] TUN-2823: Bugfix. cloudflared would hang forever if error occurred. --- origin/tunnel.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/origin/tunnel.go b/origin/tunnel.go index 6f0bd2b4..4b5edefa 100644 --- a/origin/tunnel.go +++ b/origin/tunnel.go @@ -323,8 +323,13 @@ func ServeTunnel( }) errGroup.Go(func() error { - <-reconnectCh - return fmt.Errorf("received disconnect signal") + select { + case <-reconnectCh: + return fmt.Errorf("received disconnect signal") + case <-serveCtx.Done(): + return nil + } + }) errGroup.Go(func() error {