From 17041f780f9a4991eba93aa0d1a26e41c15ccbb9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Wed, 10 Aug 2022 10:36:39 -0400
Subject: [PATCH] libnm: add small delay for connectivity changed

The primary connection signal from libnm is triggered way too soon,
before the routes added, causing generally the first requests to
failed with some socket error. Delaying this a bit helps the first
requests to pass successfully.

Change-Id: I09551ff748ac503dde187c0c937b9405cd33a914
---
 src/app/mainapplication.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/app/mainapplication.cpp b/src/app/mainapplication.cpp
index 92a581d28..6d4bebe15 100644
--- a/src/app/mainapplication.cpp
+++ b/src/app/mainapplication.cpp
@@ -35,6 +35,7 @@
 #include <QMenu>
 #include <QQmlContext>
 #include <QResource>
+#include <QTimer>
 #include <QTranslator>
 #include <QLibraryInfo>
 #include <QQuickWindow>
@@ -165,7 +166,7 @@ MainApplication::init()
 #endif
 
     connect(connectivityMonitor_.get(), &ConnectivityMonitor::connectivityChanged, [this] {
-        lrcInstance_->connectivityChanged();
+        QTimer::singleShot(500, this, [&]() { lrcInstance_->connectivityChanged(); });
     });
 
     connect(this, &QGuiApplication::focusWindowChanged, [this] {
-- 
GitLab