corewlan: avoid unnecessary currentInterface.serviceActive checks
currentInterface.serviceActive is relatively expensive and causes significant spikes in cpu load. Luckily, we can easily memorize the result. Change-Id: Ic7983b63bba5507bc1e34b0644e73365dc44f200 Task-number: QTBUG-45798 Task-number: QTCREATORBUG-15741 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>bb10
parent
c2530c7d20
commit
495e8c2054
|
|
@ -158,6 +158,7 @@ void QScanThread::run()
|
|||
mutex.lock();
|
||||
CWInterface *currentInterface = [CWInterface interfaceWithName: QCFString::toNSString(interfaceName)];
|
||||
mutex.unlock();
|
||||
const bool currentInterfaceServiceActive = currentInterface.serviceActive;
|
||||
|
||||
if (currentInterface.powerOn) {
|
||||
NSError *err = nil;
|
||||
|
|
@ -172,7 +173,7 @@ void QScanThread::run()
|
|||
|
||||
QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
|
||||
bool known = isKnownSsid(networkSsid);
|
||||
if (currentInterface.serviceActive) {
|
||||
if (currentInterfaceServiceActive) {
|
||||
if( networkSsid == QCFString::toQString( [currentInterface ssid])) {
|
||||
state = QNetworkConfiguration::Active;
|
||||
}
|
||||
|
|
@ -215,7 +216,7 @@ void QScanThread::run()
|
|||
interfaceName = ij.value();
|
||||
}
|
||||
|
||||
if (currentInterface.serviceActive) {
|
||||
if (currentInterfaceServiceActive) {
|
||||
if( networkSsid == QCFString::toQString([currentInterface ssid])) {
|
||||
state = QNetworkConfiguration::Active;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue