Skip to content

Commit

Permalink
Merge branch 'online' into 'mer-5.6'
Browse files Browse the repository at this point in the history
Online

One particular scenario fixed with this patch:

1. Session state changes from Connected to Connecting (that could be another bug but why not?)
2. _q_networkSessionStateChanged switches online to false
3. Session state changes to Disconnected, online is already false
4. online state stays false even though another configuration gets connected.

With this change, when one session becomes Disconnected, a new session is created and online state becomes true when it should.

See merge request !18
  • Loading branch information
sletta committed Jan 9, 2017
2 parents 0fa2aec + 8122f32 commit abd497e
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/network/access/qnetworkaccessmanager.cpp
Expand Up @@ -1610,23 +1610,14 @@ void QNetworkAccessManagerPrivate::_q_networkSessionClosed()
void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession::State state)
{
Q_Q(QNetworkAccessManager);

if (!networkSessionStrongRef) {
// The next stateChanged() may already be queued by the time we have
// received closed() signal and cleared the session reference.
lastSessionState = QNetworkSession::Invalid;
return;
}

bool reallyOnline = false;

//Do not emit the networkSessionConnected signal here, except for roaming -> connected
//transition, otherwise it is emitted twice in a row when opening a connection.
if (state == QNetworkSession::Connected && lastSessionState != QNetworkSession::Roaming)
emit q->networkSessionConnected();
lastSessionState = state;

if (online && state == QNetworkSession::Disconnected) {
if (state == QNetworkSession::Disconnected) {
Q_FOREACH (const QNetworkConfiguration &cfg, networkConfigurationManager.allConfigurations()) {
if (cfg.state().testFlag(QNetworkConfiguration::Active)) {
reallyOnline = true;
Expand Down

0 comments on commit abd497e

Please sign in to comment.