summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-08-26 03:41:12 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-08-26 04:33:50 (GMT)
commitbce4c42a3d0c7d24009230e09aa58db60db39d40 (patch)
tree2b9b259529c26842a282e0f346d204916b83553f /src/plugins
parent31c66e576e287271182e81c7590d7520f88829bd (diff)
downloadQt-bce4c42a3d0c7d24009230e09aa58db60db39d40.zip
Qt-bce4c42a3d0c7d24009230e09aa58db60db39d40.tar.gz
Qt-bce4c42a3d0c7d24009230e09aa58db60db39d40.tar.bz2
Restore default if to system default on session close.
If setdefaultif(0) or unsetdefaultif() is called all sockets belonging to the current process are closed by OpenC. Task-number: QTBUG-12686
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp47
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.h1
2 files changed, 32 insertions, 16 deletions
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index 1de4c0f..32eb61a 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -102,15 +102,14 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl()
// Cancel possible RConnection::Start()
Cancel();
iSocketServ.Close();
-
- // Close global 'Open C' RConnection
- // Clears also possible unsetdefaultif() flags.
- setdefaultif(0);
-
+
+ // Restore default interface to system default
+ restoreDefaultIf();
+
iConnectionMonitor.Close();
iOpenCLibrary.Close();
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
- qDebug() << "QNS this : " << QString::number((uint)this) << " - destroyed (and setdefaultif(0))";
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - destroyed (and restoreDefaultIf())";
#endif
}
@@ -523,16 +522,9 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
Cancel(); // closes iConnection
iSocketServ.Close();
-
- // Close global 'Open C' RConnection. If OpenC supports,
- // close the defaultif for good to avoid difficult timing
- // and bouncing issues of network going immediately back up
- // because of e.g. select() thread etc.
- if (iDynamicUnSetdefaultif) {
- iDynamicUnSetdefaultif();
- } else {
- setdefaultif(0);
- }
+
+ // Restore default interface to system default
+ restoreDefaultIf();
// If UserChoice, go down immediately. If some other configuration,
// go down immediately if there is no reports expected from the platform;
@@ -1457,6 +1449,29 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne
}
}
+void QNetworkSessionPrivateImpl::restoreDefaultIf()
+{
+ QNetworkConfigurationPrivatePointer config = engine->defaultConfiguration();
+
+ QMutexLocker locker(&config->mutex);
+
+ ifreq ifr;
+ memset(&ifr, 0, sizeof(ifreq));
+
+ switch (config->type) {
+ case QNetworkConfiguration::InternetAccessPoint:
+ strcpy(ifr.ifr_name, config->name.toUtf8().constData());
+ break;
+ case QNetworkConfiguration::ServiceNetwork:
+ ifr.ifr_ifru.snap_id = toSymbianConfig(config)->numericId;
+ break;
+ default:
+ ;
+ };
+
+ setdefaultif(&ifr);
+}
+
ConnectionProgressNotifier::ConnectionProgressNotifier(QNetworkSessionPrivateImpl& owner, RConnection& connection)
: CActive(CActive::EPriorityUserInput), iOwner(owner), iConnection(connection)
{
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h
index aac9321..1b0e968 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.h
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.h
@@ -143,6 +143,7 @@ private:
void handleSymbianConnectionStatusChange(TInt aConnectionStatus, TInt aError, TUint accessPointId = 0);
QNetworkConfiguration bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const;
QNetworkConfiguration activeConfiguration(TUint32 iapId = 0) const;
+ void restoreDefaultIf();
#ifndef QT_NO_NETWORKINTERFACE
QNetworkInterface interface(TUint iapId) const;
#endif