summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-11-24 11:40:52 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-11-30 15:24:09 (GMT)
commit916076bfec520210966f67ae211af65b21a29dac (patch)
treefc1dd2ae8bd1ce6226caeebb54a0827e266417e2 /src/plugins/bearer
parentbe34b17416535a3bd257398e089ad285ee3a2d77 (diff)
downloadQt-916076bfec520210966f67ae211af65b21a29dac.zip
Qt-916076bfec520210966f67ae211af65b21a29dac.tar.gz
Qt-916076bfec520210966f67ae211af65b21a29dac.tar.bz2
Symbian - prefer sessions started by this process to choose proxy
When WLAN and 3G connections are both active, the proxy for the wrong connection may have been chosen in the case of plain sockets or QNetworkAccessManager with an invalid configuration. When enumarating active connections to choose a proxy, prefer a connection that was opened by this process. Task-number: QTBUG-22615 Task-number: ou1cimx1#930701 Reviewed-by: mread
Diffstat (limited to 'src/plugins/bearer')
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp57
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.h3
2 files changed, 48 insertions, 12 deletions
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index f5f71cf..58ce8fe 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -64,7 +64,7 @@ QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine)
ipConnectionNotifier(0), ipConnectionStarter(0),
iHandleStateNotificationsFromManager(false), iFirstSync(true), iStoppedByUser(false),
iClosedByUser(false), iError(QNetworkSession::UnknownSessionError), iALREnabled(0),
- iConnectInBackground(false), isOpening(false)
+ iConnectInBackground(false), iCurrentIap(0), isOpening(false)
{
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
@@ -77,6 +77,7 @@ QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine)
void QNetworkSessionPrivateImpl::closeHandles()
{
QMutexLocker lock(&mutex);
+ updateCurrentIap(0);
// Cancel Connection Progress Notifications first.
// Note: ConnectionNotifier must be destroyed before RConnection::Close()
// => deleting ipConnectionNotifier results RConnection::CancelProgressNotification()
@@ -637,6 +638,8 @@ void QNetworkSessionPrivateImpl::accept()
QSymbianSocketManager::instance().setDefaultConnection(&iConnection);
+ updateCurrentIap(iNewRoamingIap);
+
newState(QNetworkSession::Connected, iNewRoamingIap);
}
#endif
@@ -867,19 +870,31 @@ quint64 QNetworkSessionPrivateImpl::activeTime() const
return startTime.secsTo(QDateTime::currentDateTime());
}
-QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 iapId) const
+bool QNetworkSessionPrivateImpl::activeIapId(TUint32& iapId) const
{
- if (iapId == 0) {
- _LIT(KSetting, "IAP\\Id");
- iConnection.GetIntSetting(KSetting, iapId);
+ if (!iConnection.SubSessionHandle())
+ return false;
+ _LIT(KSetting, "IAP\\Id");
+ TInt err = iConnection.GetIntSetting(KSetting, iapId);
+ if (err != KErrNone)
+ return false;
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
- // Check if this is an Easy WLAN configuration. On Symbian^3 RConnection may report
- // the used configuration as 'EasyWLAN' IAP ID if someone has just opened the configuration
- // from WLAN Scan dialog, _and_ that connection is still up. We need to find the
- // real matching configuration. Function alters the Easy WLAN ID to real IAP ID (only if
- // easy WLAN):
- easyWlanTrueIapId(iapId);
+ // Check if this is an Easy WLAN configuration. On Symbian^3 RConnection may report
+ // the used configuration as 'EasyWLAN' IAP ID if someone has just opened the configuration
+ // from WLAN Scan dialog, _and_ that connection is still up. We need to find the
+ // real matching configuration. Function alters the Easy WLAN ID to real IAP ID (only if
+ // easy WLAN):
+ easyWlanTrueIapId(iapId);
#endif
+ return true;
+}
+
+QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 iapId) const
+{
+ if (iapId == 0) {
+ bool ok = activeIapId(iapId);
+ if (!ok)
+ return QNetworkConfiguration();
}
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
@@ -1015,6 +1030,20 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
return publicConfig;
}
+void QNetworkSessionPrivateImpl::updateCurrentIap(TUint32 iapId)
+{
+ if (iCurrentIap == iapId)
+ return;
+
+ if (iCurrentIap != 0)
+ QSymbianSocketManager::instance().removeActiveConnection(iCurrentIap);
+
+ iCurrentIap = iapId;
+
+ if (iCurrentIap != 0)
+ QSymbianSocketManager::instance().addActiveConnection(iCurrentIap);
+}
+
void QNetworkSessionPrivateImpl::ConnectionStartComplete(TInt statusCode)
{
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
@@ -1028,7 +1057,10 @@ void QNetworkSessionPrivateImpl::ConnectionStartComplete(TInt statusCode)
case KErrNone: // Connection created successfully
{
TInt error = KErrNone;
- QNetworkConfiguration newActiveConfig = activeConfiguration();
+ TUint32 iapId;
+ QNetworkConfiguration newActiveConfig;
+ if (activeIapId(iapId))
+ newActiveConfig = activeConfiguration(iapId);
if (!newActiveConfig.isValid()) {
// RConnection startup was successful but no configuration
// was found. That indicates that user has chosen to create a
@@ -1038,6 +1070,7 @@ void QNetworkSessionPrivateImpl::ConnectionStartComplete(TInt statusCode)
error = KErrGeneral;
} else {
QSymbianSocketManager::instance().setDefaultConnection(&iConnection);
+ updateCurrentIap(iapId);
}
if (error != KErrNone) {
isOpen = false;
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h
index 17a051e..9e02e5b 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.h
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.h
@@ -143,6 +143,8 @@ private:
void handleSymbianConnectionStatusChange(TInt aConnectionStatus, TInt aError, TUint accessPointId = 0);
QNetworkConfiguration bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const;
QNetworkConfiguration activeConfiguration(TUint32 iapId = 0) const;
+ bool activeIapId(TUint32 &iapId) const;
+ void updateCurrentIap(TUint32 iapId);
#ifndef QT_NO_NETWORKINTERFACE
QNetworkInterface interface(TUint iapId) const;
#endif
@@ -186,6 +188,7 @@ private: // data
TUint32 iOldRoamingIap;
TUint32 iNewRoamingIap;
+ TUint32 iCurrentIap;
bool isOpening;