fix(network): report a hotspot activation removed before its reply

pull/18/head
reionwong 3 weeks ago
parent 2034e32bc5
commit 67e734a87e

@ -496,8 +496,9 @@ void Handler::hotspotRequestFinished(const QDBusMessage &reply, int activePathAr
if (state == ActiveActivated)
return;
m_hotspotActivation = active;
// Its state may have changed before this reply arrived.
if (state == ActiveDeactivated || state == ActiveDeactivating)
// Its state may have changed, or NetworkManager removed it, before this reply arrived.
const bool gone = m_client->ready() && !m_client->has(active, activeInterface);
if (gone || state == ActiveDeactivated || state == ActiveDeactivating)
activeStateChanged(active, ActiveDeactivated);
}

@ -306,6 +306,8 @@ public:
const QString activeConnection =
activate(profile, args.value(1).value<QDBusObjectPath>().path(),
args.value(2).value<QDBusObjectPath>().path());
if (dropActivations)
remove(activeConnection);
reply << FakeNM::path(profile) << FakeNM::path(activeConnection);
} else if (member == QStringLiteral("ActivateConnection")) {
reply << FakeNM::path(activate(args.value(0).value<QDBusObjectPath>().path(),
@ -349,6 +351,8 @@ public:
QHash<QString, NMVariantMapMap> settings;
QHash<QString, NMVariantMapMap> secrets;
QSet<QString> privateConnections;
// Activations fail and vanish before their reply is sent.
bool dropActivations = false;
QMap<QString, QString> permissions;
QList<QDBusMessage> calls;

@ -415,6 +415,17 @@ private slots:
QTRY_COMPARE(failed.size(), 1);
}
void hotspotGoneBeforeReplyIsReported()
{
Handler handler;
QTRY_VERIFY(handler.hotspotCapable());
QSignalSpy failed(&handler, &Handler::hotspotFailed);
nm->dropActivations = true;
handler.createHotspot();
QTRY_COMPARE(failed.size(), 1);
QVERIFY(!handler.hotspotActive());
}
void hotspotNamesTheNetworkItWouldEnd()
{
Handler handler;

Loading…
Cancel
Save