Skip to content

Commit

Permalink
[connectionagent] Remove code that is causing "race conditions"
Browse files Browse the repository at this point in the history
Connectionagent does not need try to find the bestConnectableService
when technology is powered or autoconnect-state is changed. ConnMan
can do these by itself.
  • Loading branch information
Pasi Sjöholm committed Mar 2, 2015
1 parent 11a036c commit f06f655
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 f06f655

Please sign in to comment.