- 
    Bug 
- 
    Resolution: Duplicate
- 
    P2: Important 
- 
    4.7.1
- 
    None
- 
    symbian3, Nokia N8
- 
        d238b0ba
Precondition:
Default connection is already activated (on the N8, the network seems to be started automatically before initTestCase() but on the 5800 it isn't)
Test code:
#ifndef QT_NO_BEARERMANAGEMENT
    netConfMan = new QNetworkConfigurationManager(this);
    networkConfiguration = netConfMan->defaultConfiguration();
    networkSession.reset(new QNetworkSession(networkConfiguration));
    if (!networkSession->isOpen()) {
        networkSession->open();
        bool ok = networkSession->waitForOpened(30000);
        qDebug() << networkSession->isOpen() << networkSession->error() << networkSession->errorString();
        QVERIFY(ok);
    }
#endif
Fix:
diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index eac0456..41a8854 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -310,7 +310,7 @@ bool QNetworkSession::waitForOpened(int msecs) if (d->isOpen) return true; - if (d->state != Connecting) + if (d->state != Connecting && d->state != Connected) //state is connected when opening an already active interface return false; QEventLoop loop;
Root Cause:
In the symbian implementation of void QNetworkSessionPrivateImpl::open(), there is this code:
// Avoid flip flop of states if the configuration is already // active. IsOpen/opened() will indicate when ready. if (state != QNetworkSession::Connected) { newState(QNetworkSession::Connecting); }
Which means that if syncStateWithInterface called from the constructor detected the connection is already active then the session is in connected state before open is called.