From 6fe34a3fc474c298a2df160343b9b3f09caffac2 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 21 Nov 2017 16:40:53 +0900 Subject: Workaround Qt's poor bearer management Closes #109 --- connectiondata.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/connectiondata.cpp b/connectiondata.cpp index 5b6ac71d..a982ed3e 100644 --- a/connectiondata.cpp +++ b/connectiondata.cpp @@ -26,7 +26,14 @@ using namespace QMatrixClient; QNetworkAccessManager* createNam() { - return new QNetworkAccessManager(); + auto nam = new QNetworkAccessManager(); + // See #109. Once Qt bearer management gets better, this workaround + // should become unnecessary. + nam->connect(nam, &QNetworkAccessManager::networkAccessibleChanged, + nam, [=] { + nam->setNetworkAccessible(QNetworkAccessManager::Accessible); + }); + return nam; } struct ConnectionData::Private -- cgit v1.2.3