aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2021-01-07 21:22:55 +0100
committerKitsune Ral <Kitsune-Ral@users.sf.net>2021-01-07 21:22:55 +0100
commitbe00308ad67286b45912202750fe49fb87f16e4a (patch)
tree0c430d6a2d2666ed2ca1b738eb102b866680efef /lib
parent12e00b234e5c5f4ed57b5c400d06f780e71014f4 (diff)
downloadlibquotient-be00308ad67286b45912202750fe49fb87f16e4a.tar.gz
libquotient-be00308ad67286b45912202750fe49fb87f16e4a.zip
Connection::resolveServer: abandon is not a failure
So just reset the base URL and return, with no error signals.
Diffstat (limited to 'lib')
-rw-r--r--lib/connection.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index a12b1fb5..a61f1ada 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -286,10 +286,14 @@ void Connection::resolveServer(const QString& mxid)
const auto& oldBaseUrl = d->data->baseUrl();
d->data->setBaseUrl(maybeBaseUrl); // Temporarily set it for this one call
d->resolverJob = callApi<GetWellknownJob>();
+ // Connect to finished() to make sure baseUrl is restored in any case
connect(d->resolverJob, &BaseJob::finished, this, [this, maybeBaseUrl, oldBaseUrl] {
// Revert baseUrl so that setHomeserver() below triggers signals
// in case the base URL actually changed
d->data->setBaseUrl(oldBaseUrl);
+ if (d->resolverJob->error() == BaseJob::Abandoned)
+ return;
+
if (d->resolverJob->error() != BaseJob::NotFoundError) {
if (!d->resolverJob->status().good()) {
qCWarning(MAIN)
@@ -317,7 +321,7 @@ void Connection::resolveServer(const QString& mxid)
<< "for base URL";
setHomeserver(maybeBaseUrl);
}
- Q_ASSERT(d->loginFlowsJob != nullptr);
+ Q_ASSERT(d->loginFlowsJob != nullptr); // Ensured by setHomeserver()
connect(d->loginFlowsJob, &BaseJob::success, this,
&Connection::resolved);
connect(d->loginFlowsJob, &BaseJob::failure, this, [this] {