Fix broken QNAM::networkAccessible()
When switching on/off multiple time the wifi (mainly, but not only) on ios/macos the QNAM may wrongly stay on a NotAccessible state while the configuration is Active. This change make sure the QNAM::networkAccessible() is correctly reporting the accessibility. Task-number: QTBUG-49751 Task-number: QTBUG-58275 Task-number: QTBUG-60366 Change-Id: I238ab32030fbaa8072cce341db8da6bcfc346035 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>bb10
parent
1a55c92933
commit
d80fde62ed
|
|
@ -1839,7 +1839,8 @@ void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession
|
|||
emit q->networkSessionConnected();
|
||||
lastSessionState = state;
|
||||
|
||||
if (online && state == QNetworkSession::Disconnected) {
|
||||
if (online && (state == QNetworkSession::Disconnected
|
||||
|| state == QNetworkSession::NotAvailable)) {
|
||||
const auto cfgs = networkConfigurationManager.allConfigurations();
|
||||
for (const QNetworkConfiguration &cfg : cfgs) {
|
||||
if (cfg.state().testFlag(QNetworkConfiguration::Active)) {
|
||||
|
|
@ -1881,9 +1882,9 @@ void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
|
|||
online = (networkConfiguration.state() & QNetworkConfiguration::Active);
|
||||
} else {
|
||||
if (online != isOnline) {
|
||||
online = isOnline;
|
||||
_q_networkSessionClosed();
|
||||
createSession(q->configuration());
|
||||
online = isOnline;
|
||||
}
|
||||
}
|
||||
if (online) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue