From e8fb98b6fcbace6ed7be3e4112b6a7516129ade2 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 11 Jun 2010 13:17:25 +1000 Subject: Cherry pick fix for MOBILITY-1063 from Qt Mobility. 4713262c16cb3eba1f4beccb6962a1ae210479c0 --- .../bearer/symbian/qnetworksession_impl.cpp | 35 ++++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index cce8095..1c581b6 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -53,10 +53,11 @@ QT_BEGIN_NAMESPACE QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine) - : CActive(CActive::EPriorityUserInput), engine(engine), - ipConnectionNotifier(0), iHandleStateNotificationsFromManager(false), - iFirstSync(true), iStoppedByUser(false), iClosedByUser(false), iDeprecatedConnectionId(0), - iError(QNetworkSession::UnknownSessionError), iALREnabled(0), iConnectInBackground(false) +: CActive(CActive::EPriorityUserInput), engine(engine), + iDynamicUnSetdefaultif(0), ipConnectionNotifier(0), + iHandleStateNotificationsFromManager(false), iFirstSync(true), iStoppedByUser(false), + iClosedByUser(false), iDeprecatedConnectionId(0), + iError(QNetworkSession::UnknownSessionError), iALREnabled(0), iConnectInBackground(false) { CActiveScheduler::Add(this); @@ -69,6 +70,13 @@ QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine) if (iOpenCLibrary.Load(_L("libc")) == KErrNone) { iDynamicUnSetdefaultif = (TOpenCUnSetdefaultifFunction)iOpenCLibrary.Lookup(597); } +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - "; + if (iDynamicUnSetdefaultif) + qDebug() << "dynamic setdefaultif() resolution succeeded. "; + else + qDebug() << "dynamic setdefaultif() resolution failed. "; +#endif TRAP_IGNORE(iConnectionMonitor.ConnectL()); } @@ -517,10 +525,25 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals) // that does not seem to be trusted on all Symbian versions --> safest // to go down. if (publicConfig.type() == QNetworkConfiguration::UserChoice || state == QNetworkSession::Connecting) { + SymbianNetworkConfigurationPrivate *symbianConfig = + toSymbianConfig(privateConfiguration(publicConfig)); + #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG - qDebug() << "QNS this : " << QString::number((uint)this) << " - " - << "going Disconnected because session was Connecting."; + + symbianConfig->mutex.lock(); + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "going Disconnected right away. Deprecating connection monitor ID: " + << symbianConfig->connectionId; + symbianConfig->mutex.unlock(); #endif + + // The connection has gone down, and processing of status updates must be + // stopped. Depending on platform, there may come 'connecting/connected' states + // considerably later (almost a second). Connection id is an increasing + // number, so this does not affect next _real_ 'conneting/connected' states. + symbianConfig->mutex.lock(); + iDeprecatedConnectionId = symbianConfig->connectionId; + symbianConfig->mutex.unlock(); newState(QNetworkSession::Closing); newState(QNetworkSession::Disconnected); } -- cgit v0.12