diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2020-04-29 14:45:26 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2020-04-30 14:48:56 +0000 |
commit | 382577419a80a8aebaa7ac95682cdec46a487ace (patch) | |
tree | cbe6acbe6c2c2d0983aadd687fdb414e2fb7314a /src/network/kernel | |
parent | ebc3350be7b67f6cc8ca7cf30cefd98e88b87ef5 (diff) |
QNAM/QNetConMon: Update handling of QNetworkConnectionMonitor::start
QNetworkConnectionMonitor::start was previously called after checking
d->networkAccessible, unfortunately that means if the network was
unavailable when QNetworkConnectionMonitor was created we don't
subscribe to updates or recheck the status (unless
QNetworkAccessManager::networkAccessible() is called).
Move the call to start to before the offline check. Also update the
Windows backend so that it updates networkAccessible on the call to
start()
Pick-to: 5.15
Change-Id: I37647f19f703947143e7cbdafe09619ce0d98cc1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/kernel')
-rw-r--r-- | src/network/kernel/qnetconmonitor_win.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/network/kernel/qnetconmonitor_win.cpp b/src/network/kernel/qnetconmonitor_win.cpp index 59b6cd5b66..b8cf23529a 100644 --- a/src/network/kernel/qnetconmonitor_win.cpp +++ b/src/network/kernel/qnetconmonitor_win.cpp @@ -618,6 +618,14 @@ bool QNetworkListManagerEvents::start() << errorStringFromHResult(hr); return false; } + + // Update connectivity since it might have changed since this class was constructed + NLM_CONNECTIVITY connectivity; + hr = networkListManager->GetConnectivity(&connectivity); + if (FAILED(hr)) + qCWarning(lcNetMon) << "Could not get connectivity:" << errorStringFromHResult(hr); + else + monitor->setConnectivity(connectivity); return true; } |