summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-06-10 06:18:01 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-06-24 02:27:52 (GMT)
commit94797fdd2e752677a5665abc9b23aa22f8a9c4db (patch)
tree1b191b9258120fbc2a48d7d771df49a1b9f3f80a
parent4aeb66d9c3e22a84d3c9bd916b8277537a2c4a2f (diff)
downloadQt-94797fdd2e752677a5665abc9b23aa22f8a9c4db.zip
Qt-94797fdd2e752677a5665abc9b23aa22f8a9c4db.tar.gz
Qt-94797fdd2e752677a5665abc9b23aa22f8a9c4db.tar.bz2
Cherry pick fix for MOBILITY-800 from Qt Mobility.
a05504d2a0c643c6f253527f07bcc0dba8a799b4
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp30
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.h5
-rw-r--r--tests/manual/bearerex/bearerex.cpp3
3 files changed, 31 insertions, 7 deletions
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index 04ae396..b90d603 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -63,7 +63,12 @@ QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine)
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
iMobility = NULL;
#endif
-
+ // Try to load "Open C" dll dynamically and
+ // try to attach to unsetdefaultif function dynamically.
+ // This is to avoid build breaks with old OpenC versions.
+ if (iOpenCLibrary.Load(_L("libc")) == KErrNone) {
+ iDynamicUnSetdefaultif = (TOpenCUnSetdefaultifFunction)iOpenCLibrary.Lookup(597);
+ }
TRAP_IGNORE(iConnectionMonitor.ConnectL());
}
@@ -86,14 +91,15 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl()
iMobility = NULL;
}
#endif
-
iConnection.Close();
iSocketServ.Close();
// Close global 'Open C' RConnection
+ // Clears also possible unsetdefaultif() flags.
setdefaultif(0);
iConnectionMonitor.Close();
+ iOpenCLibrary.Close();
}
void QNetworkSessionPrivateImpl::configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, QNetworkSession::State newState)
@@ -525,8 +531,15 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
iConnection.Close();
iSocketServ.Close();
- // Close global 'Open C' RConnection
- setdefaultif(0);
+ // 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);
+ }
if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
newState(QNetworkSession::Closing);
@@ -611,8 +624,13 @@ void QNetworkSessionPrivateImpl::migrate()
{
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (iMobility) {
- // Close global 'Open C' RConnection
- setdefaultif(0);
+ // Close global 'Open C' RConnection. If openC supports, use the 'heavy'
+ // version to block all subsequent requests.
+ if (iDynamicUnSetdefaultif) {
+ iDynamicUnSetdefaultif();
+ } else {
+ setdefaultif(0);
+ }
// Start migrating to new IAP
iMobility->MigrateToPreferredCarrier();
}
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h
index b045ff1..4b4f28c 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.h
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.h
@@ -73,6 +73,8 @@ QT_BEGIN_NAMESPACE
class ConnectionProgressNotifier;
class SymbianEngine;
+typedef void (*TOpenCUnSetdefaultifFunction)();
+
class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
, public MMobilityProtocolResp
@@ -153,6 +155,9 @@ private: // data
QDateTime startTime;
+ RLibrary iOpenCLibrary;
+ TOpenCUnSetdefaultifFunction iDynamicUnSetdefaultif;
+
mutable RSocketServ iSocketServ;
mutable RConnection iConnection;
mutable RConnectionMonitor iConnectionMonitor;
diff --git a/tests/manual/bearerex/bearerex.cpp b/tests/manual/bearerex/bearerex.cpp
index 00cb481..6f280db 100644
--- a/tests/manual/bearerex/bearerex.cpp
+++ b/tests/manual/bearerex/bearerex.cpp
@@ -564,7 +564,8 @@ void SessionTab::finished(quint32 errorCode, qint64 dataReceived, QString errorT
{
QMessageBox msgBox;
msgBox.setStandardButtons(QMessageBox::Close);
- msgBox.setText(QString("Data transfer completed. \nError code: ") + QString::number(errorCode) +
+ msgBox.setText(QString("Data transfer completed. \nError code: ") +
+ QString::number(int(errorCode)) +
"\nError type: " + errorType +
"\nBytes received: " +
QString::number(dataReceived));