aboutsummaryrefslogtreecommitdiff
path: root/jobs
diff options
context:
space:
mode:
Diffstat (limited to 'jobs')
-rw-r--r--jobs/basejob.cpp9
-rw-r--r--jobs/basejob.h3
2 files changed, 9 insertions, 3 deletions
diff --git a/jobs/basejob.cpp b/jobs/basejob.cpp
index e24db012..bcfd5875 100644
--- a/jobs/basejob.cpp
+++ b/jobs/basejob.cpp
@@ -54,7 +54,11 @@ BaseJob::BaseJob(ConnectionData* connection, JobHttpType type, bool needsToken)
BaseJob::~BaseJob()
{
if( d->reply )
+ {
+ if( d->reply->isRunning() )
+ d->reply->abort();
d->reply->deleteLater();
+ }
delete d;
}
@@ -115,6 +119,8 @@ void BaseJob::fail(int errorCode, QString errorString)
{
setError( errorCode );
setErrorText( errorString );
+ if( d->reply->isRunning() )
+ d->reply->abort();
emitResult();
}
@@ -149,8 +155,7 @@ void BaseJob::gotReply()
void BaseJob::timeout()
{
qDebug() << "Timeout!";
- if( d->reply->isRunning() )
- d->reply->abort();
+ fail( TimeoutError, "The job has timed out" );
}
void BaseJob::sslErrors(const QList<QSslError>& errors)
diff --git a/jobs/basejob.h b/jobs/basejob.h
index f343c769..f1ad66d1 100644
--- a/jobs/basejob.h
+++ b/jobs/basejob.h
@@ -45,7 +45,8 @@ namespace QMatrixClient
void start() override;
- enum ErrorCode { NetworkError = KJob::UserDefinedError, JsonParseError, UserDefinedError };
+ enum ErrorCode { NetworkError = KJob::UserDefinedError,
+ JsonParseError, TimeoutError, UserDefinedError };
signals:
/**