summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer/icd
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@nokia.com>2010-06-28 09:03:13 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-06-29 02:06:36 (GMT)
commitc1f7b33016db39f8e2d24d9a3dcd2df57e27c6e9 (patch)
tree96a41a6ef595a04a6f3c123de4eb1f3525388da7 /src/plugins/bearer/icd
parente391d5bb96e08db99ecb5e9efcda439450922dcc (diff)
downloadQt-c1f7b33016db39f8e2d24d9a3dcd2df57e27c6e9.zip
Qt-c1f7b33016db39f8e2d24d9a3dcd2df57e27c6e9.tar.gz
Qt-c1f7b33016db39f8e2d24d9a3dcd2df57e27c6e9.tar.bz2
When application calls QNetworkSession::close() or QNetworkSession::stop(), make sure the disconnected signal is sent even if the actual network connection is not closed.
Fixes: NB#175064 - QNetworkSession signals wrong state after calling stop()
Diffstat (limited to 'src/plugins/bearer/icd')
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.cpp55
1 files changed, 33 insertions, 22 deletions
diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp
index a6acce0..e375b4f 100644
--- a/src/plugins/bearer/icd/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp
@@ -879,9 +879,28 @@ void QNetworkSessionPrivateImpl::close()
lastError = QNetworkSession::OperationNotSupportedError;
emit QNetworkSessionPrivate::error(lastError);
} else if (isOpen) {
- opened = false;
- isOpen = false;
- emit closed();
+ if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
+ // We will not wait any disconnect from icd as it might never come
+ Maemo::Icd icd;
+#ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug() << "closing session" << publicConfig.identifier();
+#endif
+ state = QNetworkSession::Closing;
+ emit stateChanged(state);
+
+ opened = false;
+ isOpen = false;
+
+ // we fake a disconnection, session error is not sent
+ updateState(QNetworkSession::Disconnected);
+
+ icd.disconnect(ICD_CONNECTION_FLAG_APPLICATION_EVENT);
+ startTime = QDateTime();
+ } else {
+ opened = false;
+ isOpen = false;
+ emit closed();
+ }
}
}
@@ -896,33 +915,25 @@ void QNetworkSessionPrivateImpl::stop()
emit QNetworkSessionPrivate::error(lastError);
} else {
if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- if (!m_stopTimer.isActive()) {
- Maemo::Icd icd;
+ Maemo::Icd icd;
#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "stopping session" << publicConfig.identifier();
+ qDebug() << "stopping session" << publicConfig.identifier();
#endif
- state = QNetworkSession::Closing;
- emit stateChanged(state);
-
- opened = false;
- isOpen = false;
+ state = QNetworkSession::Closing;
+ emit stateChanged(state);
- icd.disconnect(ICD_CONNECTION_FLAG_APPLICATION_EVENT);
- startTime = QDateTime();
+ // we fake a disconnection, a session error is sent also
+ updateState(QNetworkSession::Disconnected);
- /* Note: Session state will change to disconnected
- * as soon as QNetworkConfigurationManager sends
- * corresponding iapStateChanged signal.
- */
+ opened = false;
+ isOpen = false;
- // Make sure that this Session will send closed signal
- // even though ICD connection will not ever get closed
- m_stopTimer.start(ICD_SHORT_CONNECT_TIMEOUT); // 10 seconds wait
- }
+ icd.disconnect(ICD_CONNECTION_FLAG_APPLICATION_EVENT);
+ startTime = QDateTime();
} else {
opened = false;
isOpen = false;
- emit closed();
+ emit closed();
}
}
}