summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorPeter Hartmann <phartmann@rim.com>2013-01-25 08:38:47 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-03 09:29:21 (GMT)
commit5593ff874812e5c285af609faad834f448a2dae7 (patch)
treeb2b10bc4efcd0eea3fda84aaf7e54631506a2f7b /src/plugins
parenta7d02de7bc2efecd00033508d9f54190b0365256 (diff)
downloadQt-5593ff874812e5c285af609faad834f448a2dae7.zip
Qt-5593ff874812e5c285af609faad834f448a2dae7.tar.gz
Qt-5593ff874812e5c285af609faad834f448a2dae7.tar.bz2
BlackBerry bearer plugin: check whether device is online several times
This is supposed to workaround a race condition in the underlying netstatus API: Sometimes we get an event that the Wifi interface changed, but it is not up, e.g. no gateway (yet). In that case we need to check back (currently: 300 ms) whether the interface has come up or not. This commit can be reverted again once the race condition in the netstatus API has been resolved. Task-number: QTBUG-29421 (cherry picked from commit 3dc47622a469ded1c99397fdedc2053b73d57189) Change-Id: I252c39411340fe3f6af8440a8f21482ca9b6e62d Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/bearer/blackberry/qbbengine.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/bearer/blackberry/qbbengine.cpp b/src/plugins/bearer/blackberry/qbbengine.cpp
index 908fecc..7233dfa 100644
--- a/src/plugins/bearer/blackberry/qbbengine.cpp
+++ b/src/plugins/bearer/blackberry/qbbengine.cpp
@@ -45,6 +45,7 @@
#include <QDebug>
#include <QThreadStorage>
#include <QStringList>
+#include <QTimer>
#include <bps/netstatus.h>
@@ -369,6 +370,9 @@ void QBBEngine::updateConfiguration(const char *interface)
changed = true;
}
+ const netstatus_ip_status_t oldIpStatus = ptr->oldIpStatus;
+ ptr->oldIpStatus = ipStatus;
+
ptrLocker.unlock();
locker.unlock();
@@ -378,7 +382,17 @@ void QBBEngine::updateConfiguration(const char *interface)
Q_EMIT configurationChanged(ptr);
} else {
+ // maybe Wifi has changed but gateway not yet ready etc.
qBearerDebug() << Q_FUNC_INFO << "configuration has not changed.";
+ if (oldIpStatus != ipStatus) { // if IP status changed
+ if (ipStatus != NETSTATUS_IP_STATUS_OK
+ && ipStatus != NETSTATUS_IP_STATUS_ERROR_NOT_UP
+ && ipStatus != NETSTATUS_IP_STATUS_ERROR_NOT_CONFIGURED) {
+ // work around race condition in netstatus API by just checking
+ // again in 300 ms
+ QTimer::singleShot(300, this, SLOT(doRequestUpdate()));
+ }
+ }
}
return;