fix(net): fix emit signals in download & upload task

Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
seth 2023-06-25 18:49:50 -04:00
parent 4ea0a567bc
commit c49ee87857
No known key found for this signature in database
GPG Key ID: D31BD0D494BBEE86
2 changed files with 12 additions and 12 deletions

View File

@ -117,7 +117,7 @@ void Download::executeTask()
switch (m_state) {
case State::Succeeded:
qCDebug(taskDownloadLogC) << getUid().toString() << "Download cache hit " << m_url.toString();
emitSucceeded();
emit succeeded();
return;
case State::Running:
qCDebug(taskDownloadLogC) << getUid().toString() << "Downloading " << m_url.toString();
@ -294,19 +294,19 @@ void Download::downloadFinished()
qCDebug(taskDownloadLogC) << getUid().toString() << "Download failed but we are allowed to proceed:" << m_url.toString();
m_sink->abort();
m_reply.reset();
emitSucceeded();
emit succeeded();
return;
} else if (m_state == State::Failed) {
qCDebug(taskDownloadLogC) << getUid().toString() << "Download failed in previous step:" << m_url.toString();
m_sink->abort();
m_reply.reset();
emitFailed("");
emit failed("");
return;
} else if (m_state == State::AbortedByUser) {
qCDebug(taskDownloadLogC) << getUid().toString() << "Download aborted in previous step:" << m_url.toString();
m_sink->abort();
m_reply.reset();
emitAborted();
emit aborted();
return;
}
@ -323,13 +323,13 @@ void Download::downloadFinished()
qCDebug(taskDownloadLogC) << getUid().toString() << "Download failed to finalize:" << m_url.toString();
m_sink->abort();
m_reply.reset();
emitFailed("");
emit failed("");
return;
}
m_reply.reset();
qCDebug(taskDownloadLogC) << getUid().toString() << "Download succeeded:" << m_url.toString();
emitSucceeded();
emit succeeded();
}
void Download::downloadReadyRead()

View File

@ -157,19 +157,19 @@ void Upload::downloadFinished()
qCDebug(taskUploadLogC) << getUid().toString() << "Upload failed but we are allowed to proceed:" << m_url.toString();
m_sink->abort();
m_reply.reset();
emitSucceeded();
emit succeeded();
return;
} else if (m_state == State::Failed) {
qCDebug(taskUploadLogC) << getUid().toString() << "Upload failed in previous step:" << m_url.toString();
m_sink->abort();
m_reply.reset();
emitFailed("");
emit failed("");
return;
} else if (m_state == State::AbortedByUser) {
qCDebug(taskUploadLogC) << getUid().toString() << "Upload aborted in previous step:" << m_url.toString();
m_sink->abort();
m_reply.reset();
emitAborted();
emit aborted();
return;
}
@ -186,12 +186,12 @@ void Upload::downloadFinished()
qCDebug(taskUploadLogC) << getUid().toString() << "Upload failed to finalize:" << m_url.toString();
m_sink->abort();
m_reply.reset();
emitFailed("");
emit failed("");
return;
}
m_reply.reset();
qCDebug(taskUploadLogC) << getUid().toString() << "Upload succeeded:" << m_url.toString();
emitSucceeded();
emit succeeded();
}
void Upload::downloadReadyRead()
@ -208,7 +208,7 @@ void Upload::executeTask()
if (m_state == State::AbortedByUser) {
qCWarning(taskUploadLogC) << getUid().toString() << "Attempt to start an aborted Upload:" << m_url.toString();
emitAborted();
emit aborted();
return;
}
QNetworkRequest request(m_url);