summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-06-11 03:03:19 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-06-24 02:27:57 (GMT)
commit2faa2ff804a8ed4e0bb60a4d11cd424a0e160dc8 (patch)
tree64058fe087d9b6910824121a05b32876ea36e6e1 /src
parent94c64b9ae4d539e9578156a0df999de1605f858f (diff)
downloadQt-2faa2ff804a8ed4e0bb60a4d11cd424a0e160dc8.zip
Qt-2faa2ff804a8ed4e0bb60a4d11cd424a0e160dc8.tar.gz
Qt-2faa2ff804a8ed4e0bb60a4d11cd424a0e160dc8.tar.bz2
Cherry pick fix for MOBILITY-1063 from Qt Mobility.
37ad80914f7acb8d4f3364d78e75d48cd14e8e2a
Diffstat (limited to 'src')
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp69
1 files changed, 18 insertions, 51 deletions
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index 940281c..cce8095 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -83,9 +83,6 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl()
delete ipConnectionNotifier;
ipConnectionNotifier = NULL;
- // Cancel possible RConnection::Start()
- Cancel();
-
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (iMobility) {
delete iMobility;
@@ -93,7 +90,8 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl()
}
#endif
- iConnection.Close();
+ // Cancel possible RConnection::Start()
+ Cancel();
iSocketServ.Close();
// Close global 'Open C' RConnection
@@ -366,44 +364,6 @@ void QNetworkSessionPrivateImpl::open()
}
if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) {
- // Search through existing connections.
- // If there is already connection which matches to given IAP
- // try to attach to existing connection.
- TBool connected(EFalse);
- TConnectionInfoBuf connInfo;
- TUint count;
- if (iConnection.EnumerateConnections(count) == KErrNone) {
- for (TUint i=1; i<=count; i++) {
- // Note: GetConnectionInfo expects 1-based index.
- if (iConnection.GetConnectionInfo(i, connInfo) == KErrNone) {
- SymbianNetworkConfigurationPrivate *symbianConfig =
- toSymbianConfig(privateConfiguration(publicConfig));
-
- if (connInfo().iIapId == symbianConfig->numericIdentifier()) {
- if (iConnection.Attach(connInfo, RConnection::EAttachTypeNormal) == KErrNone) {
- activeConfig = publicConfig;
-#ifndef QT_NO_NETWORKINTERFACE
- activeInterface = interface(symbianConfig->numericIdentifier());
-#endif
- connected = ETrue;
- startTime = QDateTime::currentDateTime();
- // Use name of the IAP to open global 'Open C' RConnection
- QByteArray nameAsByteArray = publicConfig.name().toUtf8();
- ifreq ifr;
- memset(&ifr, 0, sizeof(struct ifreq));
- strcpy(ifr.ifr_name, nameAsByteArray.constData());
- error = setdefaultif(&ifr);
- isOpen = true;
- // Make sure that state will be Connected
- newState(QNetworkSession::Connected);
- emit quitPendingWaitsForOpened();
- break;
- }
- }
- }
- }
- }
- if (!connected) {
SymbianNetworkConfigurationPrivate *symbianConfig =
toSymbianConfig(privateConfiguration(publicConfig));
@@ -429,7 +389,6 @@ void QNetworkSessionPrivateImpl::open()
SetActive();
}
newState(QNetworkSession::Connecting);
- }
} else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
SymbianNetworkConfigurationPrivate *symbianConfig =
toSymbianConfig(privateConfiguration(publicConfig));
@@ -508,15 +467,16 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
<< "close() called, session state is: " << state << " and isOpen is : "
<< isOpen;
#endif
- if (!isOpen) {
+
+ if (!isOpen && state != QNetworkSession::Connecting) {
return;
}
// Mark this session as closed-by-user so that we are able to report
// distinguish between stop() and close() state transitions
// when reporting.
iClosedByUser = true;
-
isOpen = false;
+
#ifndef OCC_FUNCTIONALITY_AVAILABLE
// On Symbian^3 we need to keep track of active configuration longer
// in case of empty-SNAP-triggered EasyWLAN.
@@ -524,7 +484,6 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
#endif
serviceConfig = QNetworkConfiguration();
- Cancel();
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (iMobility) {
delete iMobility;
@@ -538,7 +497,7 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
iHandleStateNotificationsFromManager = true;
}
- iConnection.Close();
+ Cancel(); // closes iConnection
iSocketServ.Close();
// Close global 'Open C' RConnection. If OpenC supports,
@@ -551,11 +510,20 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
setdefaultif(0);
}
- if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
+ // If UserChoice, go down immediately. If some other configuration,
+ // go down immediately if there is no reports expected from the platform;
+ // in practice Connection Monitor is aware of connections only after
+ // KFinishedSelection event, and hence reports only after that event, but
+ // that does not seem to be trusted on all Symbian versions --> safest
+ // to go down.
+ if (publicConfig.type() == QNetworkConfiguration::UserChoice || state == QNetworkSession::Connecting) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "going Disconnected because session was Connecting.";
+#endif
newState(QNetworkSession::Closing);
newState(QNetworkSession::Disconnected);
}
-
if (allowSignals) {
emit closed();
}
@@ -755,7 +723,7 @@ void QNetworkSessionPrivateImpl::Error(TInt /*aError*/)
{
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
qDebug() << "QNS this : " << QString::number((uint)this) << " - "
- << "roaming Error() occured";
+ << "roaming Error() occured, isOpen is: " << isOpen;
#endif
if (isOpen) {
isOpen = false;
@@ -1361,7 +1329,6 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne
case KFinishedSelection:
if (aError == KErrNone)
{
- // The user successfully selected an IAP to be used
break;
}
else