diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-03-10 00:16:51 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-03-10 00:16:51 (GMT) |
commit | cbda8ea64d8492d7c8f125cc1b43396b91ecdd8e (patch) | |
tree | 7c05d1691e6d571620d355ce7314c51e914e56d8 /src | |
parent | 9227f8606c85ad9a472628a8a06c312452d69f14 (diff) | |
download | Qt-cbda8ea64d8492d7c8f125cc1b43396b91ecdd8e.zip Qt-cbda8ea64d8492d7c8f125cc1b43396b91ecdd8e.tar.gz Qt-cbda8ea64d8492d7c8f125cc1b43396b91ecdd8e.tar.bz2 |
Don't wait forever when scanning for wifi networks on win32 fails.
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/bearer/nativewifi/qnativewifiengine.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 952a6a3..b6522ad 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -111,8 +111,6 @@ void QNativeWifiEngine::scanComplete() { QMutexLocker locker(&mutex); - QStringList previous = accessPointConfigurations.keys(); - // enumerate interfaces WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); @@ -120,9 +118,15 @@ void QNativeWifiEngine::scanComplete() #ifdef BEARER_MANAGEMENT_DEBUG qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); #endif + + locker.unlock(); + emit updateCompleted(); + return; } + QStringList previous = accessPointConfigurations.keys(); + for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i]; @@ -458,18 +462,31 @@ void QNativeWifiEngine::requestUpdate() #ifdef BEARER_MANAGEMENT_DEBUG qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); #endif + + locker.unlock(); + emit updateCompleted(); + return; } + bool requested = false; for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { result = local_WlanScan(handle, &interfaceList->InterfaceInfo[i].InterfaceGuid, 0, 0, 0); + if (result != ERROR_SUCCESS) { #ifdef BEARER_MANAGEMENT_DEBUG - if (result != ERROR_SUCCESS) qDebug("%s: WlanScan failed with error %ld\n", __FUNCTION__, result); #endif + } else { + requested = true; + } } local_WlanFreeMemory(interfaceList); + + if (!requested) { + locker.unlock(); + emit updateCompleted(); + } } QNetworkSession::State QNativeWifiEngine::sessionStateForId(const QString &id) |