Fix bogus error report when disconnect/stop actually works
The interfaces serviceActive does not mean the network is connected, so we get the next best thing - the interfaces associated ssid will be empty if a previously connected AP is now disconnected. Task-number: QTBUG-42087 Change-Id: I539811d9f18cc553a4022a03686fb8a864b98491 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>bb10
parent
d6d3841e71
commit
575008ec81
|
|
@ -83,6 +83,7 @@ public:
|
|||
private Q_SLOTS:
|
||||
void doRequestUpdate();
|
||||
void networksChanged();
|
||||
void checkDisconnect();
|
||||
|
||||
private:
|
||||
bool isWifiReady(const QString &dev);
|
||||
|
|
@ -95,6 +96,7 @@ private:
|
|||
QScanThread *scanThread;
|
||||
|
||||
quint64 getBytes(const QString &interfaceName,bool b);
|
||||
QString disconnectedInterfaceString;
|
||||
|
||||
protected:
|
||||
void startNetworkChangeLoop();
|
||||
|
|
|
|||
|
|
@ -544,20 +544,44 @@ void QCoreWlanEngine::disconnectFromId(const QString &id)
|
|||
QMutexLocker locker(&mutex);
|
||||
|
||||
QString interfaceString = getInterfaceFromId(id);
|
||||
if (interfaceString.isEmpty()) {
|
||||
locker.unlock();
|
||||
emit connectionError(id, DisconnectionError);
|
||||
return;
|
||||
}
|
||||
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
CWInterface *wifiInterface =
|
||||
[CWInterface interfaceWithName: QCFString::toNSString(interfaceString)];
|
||||
disconnectedInterfaceString = interfaceString;
|
||||
|
||||
[wifiInterface disassociate];
|
||||
if (wifiInterface.serviceActive) {
|
||||
locker.unlock();
|
||||
emit connectionError(id, DisconnectionError);
|
||||
locker.relock();
|
||||
}
|
||||
|
||||
QTimer::singleShot(1000, this,SLOT(checkDisconnect()));
|
||||
[autoreleasepool release];
|
||||
}
|
||||
|
||||
void QCoreWlanEngine::checkDisconnect()
|
||||
{
|
||||
QMutexLocker locker(&mutex);
|
||||
if (!disconnectedInterfaceString.isEmpty()) {
|
||||
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
CWInterface *wifiInterface =
|
||||
[CWInterface interfaceWithName: QCFString::toNSString(disconnectedInterfaceString)];
|
||||
|
||||
const QString networkSsid = QCFString::toQString([wifiInterface ssid]);
|
||||
if (!networkSsid.isEmpty()) {
|
||||
const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
|
||||
locker.unlock();
|
||||
emit connectionError(id, DisconnectionError);
|
||||
locker.relock();
|
||||
}
|
||||
[autoreleasepool release];
|
||||
disconnectedInterfaceString.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void QCoreWlanEngine::requestUpdate()
|
||||
{
|
||||
scanThread->getUserConfigurations();
|
||||
|
|
|
|||
Loading…
Reference in New Issue