Skip to content

Commit

Permalink
[vpnmodel] VPN disconnects should go through connman. JB#42710
Browse files Browse the repository at this point in the history
It's not a good idea to manipulate VPN connections behind connman's back.
  • Loading branch information
monich authored and rainemak committed Aug 22, 2018
1 parent 27b75fc commit 1bf576d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/vpnmodel.cpp
Expand Up @@ -560,8 +560,8 @@ void VpnModel::activateConnection(const QString &path)
void VpnModel::deactivateConnection(const QString &path)
{
qCInfo(lcVpnLog) << "Disconnect" << path;
auto it = connections_.find(path);
if (it != connections_.end()) {
ConnmanServiceProxy* proxy = vpnServices_.value(path);
if (proxy) {
VpnConnection *connection = this->connection(path);
if (connection && !pendingDisconnects_.contains(path) && (connection->state() == VpnModel::Ready ||
connection->state() == VpnModel::Configuration)) {
Expand All @@ -570,8 +570,6 @@ void VpnModel::deactivateConnection(const QString &path)
connect(connection, &VpnConnection::stateChanged, this, &VpnModel::updatePendingDisconnectState, Qt::UniqueConnection);
}

ConnmanVpnConnectionProxy *proxy(*it);

QDBusPendingCall call = proxy->Disconnect();

QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
Expand Down

0 comments on commit 1bf576d

Please sign in to comment.