mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-29 23:29:58 +00:00
TUN-5285: Fallback to HTTP2 immediately if connection times out with no network activity
This commit is contained in:
@@ -190,7 +190,13 @@ func ServeTunnelLoop(
|
||||
case <-gracefulShutdownC:
|
||||
return nil
|
||||
case <-protocolFallback.BackoffTimer():
|
||||
if !selectNextProtocol(&connLog, protocolFallback, config.ProtocolSelector) {
|
||||
var idleTimeoutError *quic.IdleTimeoutError
|
||||
if !selectNextProtocol(
|
||||
&connLog,
|
||||
protocolFallback,
|
||||
config.ProtocolSelector,
|
||||
errors.As(err, &idleTimeoutError),
|
||||
) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -222,8 +228,9 @@ func selectNextProtocol(
|
||||
connLog *zerolog.Logger,
|
||||
protocolBackoff *protocolFallback,
|
||||
selector connection.ProtocolSelector,
|
||||
isNetworkActivityTimeout bool,
|
||||
) bool {
|
||||
if protocolBackoff.ReachedMaxRetries() {
|
||||
if protocolBackoff.ReachedMaxRetries() || isNetworkActivityTimeout {
|
||||
fallback, hasFallback := selector.Fallback()
|
||||
if !hasFallback {
|
||||
return false
|
||||
|
Reference in New Issue
Block a user