From 1107f6eb5fc85dfc1a9aeb5c6f0d8ff777e27ee9 Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Fri, 14 May 2021 14:26:02 +0100 Subject: [PATCH] lib/connections: Reduce default quic redial interval (fixes #7471) (#7672) * lib/connections: Reduce default quic redial interval (fixes #7471) * Update quic_dial.go --- lib/connections/quic_dial.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/connections/quic_dial.go b/lib/connections/quic_dial.go index 3d905dc48..83c6246f5 100644 --- a/lib/connections/quic_dial.go +++ b/lib/connections/quic_dial.go @@ -93,8 +93,15 @@ func (d *quicDialer) Dial(ctx context.Context, _ protocol.DeviceID, uri *url.URL type quicDialerFactory struct{} func (quicDialerFactory) New(opts config.OptionsConfiguration, tlsCfg *tls.Config) genericDialer { + // So the idea is that we should probably try dialing every 20 seconds. + // However it would still be nice if this was adjustable/proportional to ReconnectIntervalS + // But prevent something silly like 1/3 = 0 etc. + quicInterval := opts.ReconnectIntervalS / 3 + if quicInterval < 10 { + quicInterval = 10 + } return &quicDialer{commonDialer{ - reconnectInterval: time.Duration(opts.ReconnectIntervalS) * time.Second, + reconnectInterval: time.Duration(quicInterval) * time.Second, tlsCfg: tlsCfg, }} }