make the keep alive interval configurable #3444
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So far the
KeepAlive
property forquic.Config
allowed only to enable Ping send on inactivequic.Connection
. That would happen half-way through theMaxIdleTimeout
.With this change, we make the configuration more flexible, by turning that property into
KeepAlivePeriod
, which allows to define the period for sending Ping frame since last activity for thatquic.Connection
.The value used is the smaller one among:
MaxIdleTimeout/2
KeepAlivePeriod
MaxKeepAliveInterval
Context: We're using
quic-go
in https://github.com/cloudflare/cloudflared as a substrate for proxying multiplexed application traffic (e.g. TCP/UDP traffic).Why: We've found situations where our
quic.Connection
s were closed due to no network activity and we believe they should not have, for which having more pings could have potentially have helped during the idle period.This should not change behaviour for anyone not caring about keep alive.
For those that defined the property, this is a breaking change API-wise (albeit a trivial one to fix). If that's worrisome, we can keep the existing
KeepAlive
flag and add the new one on the side (whereKeepAlive
being true defaults to half the idle period unless theKeepAlivePeriod
new flag is configured).