aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-08-04 13:30:21 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-08-04 13:51:39 +0200
commit68a4875c047611e7f58ed001dc9ec4231a11728a (patch)
treec9f784d8e29232c35da0562e0148264156e74eda /lib
parent2804099f16a15f6098d26c5d62749d2d1aab9ea2 (diff)
downloadlibquotient-68a4875c047611e7f58ed001dc9ec4231a11728a.tar.gz
libquotient-68a4875c047611e7f58ed001dc9ec4231a11728a.zip
Connection: stop the sync loop on SyncJob::failure
Diffstat (limited to 'lib')
-rw-r--r--lib/connection.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index 46494a56..4530d95a 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -508,7 +508,9 @@ void Connection::sync(int timeout)
retriesTaken, nextInMilliseconds);
});
connect(job, &SyncJob::failure, this, [this, job] {
- d->syncJob = nullptr;
+ // SyncJob persists with retries on transient errors; if it fails,
+ // there's likely something serious enough to stop the loop.
+ stopSync();
if (job->error() == BaseJob::Unauthorised) {
qCWarning(SYNCJOB)
<< "Sync job failed with Unauthorised - login expired?";
@@ -742,7 +744,8 @@ void Connection::stopSync()
disconnect(d->syncLoopConnection);
if (d->syncJob) // If there's an ongoing sync job, stop it too
{
- d->syncJob->abandon();
+ if (d->syncJob->status().code == BaseJob::Pending)
+ d->syncJob->abandon();
d->syncJob = nullptr;
}
}