Skip to content

Commit 9ed536c

Browse files
committed
TUN-3738: Consume UI events even when UI is disabled
Not doing so was causing cloudflared to become stuck after some time. This would happen because the Observer pattern was sending events to the UI channel (that has 16 slots) but no one was consuming those when the UI is not enabled (which is the default case). Hence, events (such as connection disconnect / reconnect) would cause that buffer to be full and cause cloudflared to become apparently stuck, in the sense that the connections would not be reconnected.
1 parent 119d96c commit 9ed536c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmd/cloudflared/tunnel/cmd.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,12 @@ func StartServer(
377377
tunnelConfig.HAConnections,
378378
)
379379
tunnelInfo.LaunchUI(ctx, log, transportLog, uiCh)
380+
} else {
381+
go func() {
382+
for range uiCh {
383+
// Consume UI events into a noop
384+
}
385+
}()
380386
}
381387

382388
return waitToShutdown(&wg, errC, shutdownC, graceShutdownC, c.Duration("grace-period"), log)

0 commit comments

Comments
 (0)