Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #96 from tigeli/master
[connectionagent] Remove code that is causing "race conditions"
  • Loading branch information
tigeli committed Mar 2, 2015
2 parents 11a036c + f06f655 commit ba458ea
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions connd/qconnectionagent.cpp
Expand Up @@ -511,18 +511,6 @@ void QConnectionAgent::technologyPowerChanged(bool powered)
// wifi tech might not be ready, so delay this
QTimer::singleShot(1000,this,SLOT(setWifiTetheringEnabled()));
}

if (!delayedTethering) {
if (!powered) {
removeAllTypes("wifi"); //dont wait for connman, he's too slow at this
QString bestService = findBestConnectableService();
if (!bestService.isEmpty()) {
qDebug() << "<<<<<<<<<<< requestConnect() >>>>>>>>>>>>";
int pos = orderedServicesList.indexOf(bestService);
orderedServicesList.at(pos).service->requestConnect();
}
}
}
}

void QConnectionAgent::techChanged()
Expand Down Expand Up @@ -627,36 +615,10 @@ void QConnectionAgent::serviceAutoconnectChanged(bool on)
if (!service)
return;
qDebug() << service->path() << "AutoConnect is" << on;
bool mobileConnected = false;

if (!on) {
if (service->state() != "idle")
service->requestDisconnect();

qDebug() << "find best service here";
QString selectedServicePath = findBestConnectableService();
if (!selectedServicePath.isEmpty()) {
qDebug() << "<<<<<<<<<<< requestConnect() >>>>>>>>>>>>";
int pos = orderedServicesList.indexOf(selectedServicePath);
orderedServicesList.at(pos).service->requestConnect();
}
} else {
if (!isStateOnline(service->state())) {
if (service->type() == "cellular") {
QVector<NetworkService*> cellServices = netman->getServices("cellular");
Q_FOREACH (NetworkService *cService, cellServices) {
if (isStateOnline(cService->state())) {
mobileConnected = true;
}
}
}

if ((service->type() == "wifi" && mobileConnected)
|| isBestService(service)) {
qDebug() << "<<<<<<<<<<< requestConnect() >>>>>>>>>>>>";
service->requestConnect();
}
}
}
}

Expand Down

0 comments on commit ba458ea

Please sign in to comment.