summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.cpp35
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.h6
2 files changed, 8 insertions, 33 deletions
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp
index 022365e..fd1052c 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.cpp
+++ b/src/network/bearer/qnetworkconfigmanager_p.cpp
@@ -60,7 +60,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
#endif
QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate()
- : QObject(), pollTimer(0), mutex(QMutex::Recursive), forcedPolling(0), firstUpdate(true)
+ : QObject(), mutex(QMutex::Recursive), forcedPolling(0), firstUpdate(true)
{
qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration");
qRegisterMetaType<QNetworkConfigurationPrivatePointer>("QNetworkConfigurationPrivatePointer");
@@ -442,34 +442,11 @@ void QNetworkConfigurationManagerPrivate::startPolling()
{
QMutexLocker locker(&mutex);
- bool pollingRequired = false;
-
- if (forcedPolling > 0) {
- foreach (QBearerEngine *engine, sessionEngines) {
- if (engine->requiresPolling()) {
- pollingRequired = true;
- break;
- }
- }
- }
-
- if (!pollingRequired) {
- foreach (QBearerEngine *engine, sessionEngines) {
- if (engine->configurationsInUse()) {
- pollingRequired = true;
- break;
- }
- }
- }
-
- if (pollingRequired) {
- if (!pollTimer) {
- pollTimer = new QTimer(this);
- pollTimer->setInterval(10000);
- pollTimer->setSingleShot(true);
- connect(pollTimer, SIGNAL(timeout()), this, SLOT(pollEngines()));
+ foreach (QBearerEngine *engine, sessionEngines) {
+ if (engine->requiresPolling() && (forcedPolling || engine->configurationsInUse())) {
+ QTimer::singleShot(10000, this, SLOT(pollEngines()));
+ break;
}
- pollTimer->start();
}
}
@@ -492,7 +469,7 @@ void QNetworkConfigurationManagerPrivate::enablePolling()
++forcedPolling;
if (forcedPolling == 1)
- QMetaObject::invokeMethod(this, "startPolling");
+ startPolling();
}
void QNetworkConfigurationManagerPrivate::disablePolling()
diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h
index 9b946d8..16c2c4b 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.h
+++ b/src/network/bearer/qnetworkconfigmanager_p.h
@@ -64,7 +64,6 @@
QT_BEGIN_NAMESPACE
class QBearerEngine;
-class QTimer;
class Q_NETWORK_EXPORT QNetworkConfigurationManagerPrivate : public QObject
{
@@ -86,8 +85,6 @@ public:
QList<QBearerEngine *> engines() const;
- Q_INVOKABLE void startPolling();
-
void enablePolling();
void disablePolling();
@@ -109,8 +106,9 @@ private Q_SLOTS:
void pollEngines();
private:
- QTimer *pollTimer;
+ void startPolling();
+private:
mutable QMutex mutex;
QList<QBearerEngine *> sessionEngines;