fix(net): fix emit signals in download & upload task
Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
parent
4ea0a567bc
commit
c49ee87857
@ -117,7 +117,7 @@ void Download::executeTask()
|
|||||||
switch (m_state) {
|
switch (m_state) {
|
||||||
case State::Succeeded:
|
case State::Succeeded:
|
||||||
qCDebug(taskDownloadLogC) << getUid().toString() << "Download cache hit " << m_url.toString();
|
qCDebug(taskDownloadLogC) << getUid().toString() << "Download cache hit " << m_url.toString();
|
||||||
emitSucceeded();
|
emit succeeded();
|
||||||
return;
|
return;
|
||||||
case State::Running:
|
case State::Running:
|
||||||
qCDebug(taskDownloadLogC) << getUid().toString() << "Downloading " << m_url.toString();
|
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();
|
qCDebug(taskDownloadLogC) << getUid().toString() << "Download failed but we are allowed to proceed:" << m_url.toString();
|
||||||
m_sink->abort();
|
m_sink->abort();
|
||||||
m_reply.reset();
|
m_reply.reset();
|
||||||
emitSucceeded();
|
emit succeeded();
|
||||||
return;
|
return;
|
||||||
} else if (m_state == State::Failed) {
|
} else if (m_state == State::Failed) {
|
||||||
qCDebug(taskDownloadLogC) << getUid().toString() << "Download failed in previous step:" << m_url.toString();
|
qCDebug(taskDownloadLogC) << getUid().toString() << "Download failed in previous step:" << m_url.toString();
|
||||||
m_sink->abort();
|
m_sink->abort();
|
||||||
m_reply.reset();
|
m_reply.reset();
|
||||||
emitFailed("");
|
emit failed("");
|
||||||
return;
|
return;
|
||||||
} else if (m_state == State::AbortedByUser) {
|
} else if (m_state == State::AbortedByUser) {
|
||||||
qCDebug(taskDownloadLogC) << getUid().toString() << "Download aborted in previous step:" << m_url.toString();
|
qCDebug(taskDownloadLogC) << getUid().toString() << "Download aborted in previous step:" << m_url.toString();
|
||||||
m_sink->abort();
|
m_sink->abort();
|
||||||
m_reply.reset();
|
m_reply.reset();
|
||||||
emitAborted();
|
emit aborted();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,13 +323,13 @@ void Download::downloadFinished()
|
|||||||
qCDebug(taskDownloadLogC) << getUid().toString() << "Download failed to finalize:" << m_url.toString();
|
qCDebug(taskDownloadLogC) << getUid().toString() << "Download failed to finalize:" << m_url.toString();
|
||||||
m_sink->abort();
|
m_sink->abort();
|
||||||
m_reply.reset();
|
m_reply.reset();
|
||||||
emitFailed("");
|
emit failed("");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_reply.reset();
|
m_reply.reset();
|
||||||
qCDebug(taskDownloadLogC) << getUid().toString() << "Download succeeded:" << m_url.toString();
|
qCDebug(taskDownloadLogC) << getUid().toString() << "Download succeeded:" << m_url.toString();
|
||||||
emitSucceeded();
|
emit succeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Download::downloadReadyRead()
|
void Download::downloadReadyRead()
|
||||||
|
@ -157,19 +157,19 @@ void Upload::downloadFinished()
|
|||||||
qCDebug(taskUploadLogC) << getUid().toString() << "Upload failed but we are allowed to proceed:" << m_url.toString();
|
qCDebug(taskUploadLogC) << getUid().toString() << "Upload failed but we are allowed to proceed:" << m_url.toString();
|
||||||
m_sink->abort();
|
m_sink->abort();
|
||||||
m_reply.reset();
|
m_reply.reset();
|
||||||
emitSucceeded();
|
emit succeeded();
|
||||||
return;
|
return;
|
||||||
} else if (m_state == State::Failed) {
|
} else if (m_state == State::Failed) {
|
||||||
qCDebug(taskUploadLogC) << getUid().toString() << "Upload failed in previous step:" << m_url.toString();
|
qCDebug(taskUploadLogC) << getUid().toString() << "Upload failed in previous step:" << m_url.toString();
|
||||||
m_sink->abort();
|
m_sink->abort();
|
||||||
m_reply.reset();
|
m_reply.reset();
|
||||||
emitFailed("");
|
emit failed("");
|
||||||
return;
|
return;
|
||||||
} else if (m_state == State::AbortedByUser) {
|
} else if (m_state == State::AbortedByUser) {
|
||||||
qCDebug(taskUploadLogC) << getUid().toString() << "Upload aborted in previous step:" << m_url.toString();
|
qCDebug(taskUploadLogC) << getUid().toString() << "Upload aborted in previous step:" << m_url.toString();
|
||||||
m_sink->abort();
|
m_sink->abort();
|
||||||
m_reply.reset();
|
m_reply.reset();
|
||||||
emitAborted();
|
emit aborted();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,12 +186,12 @@ void Upload::downloadFinished()
|
|||||||
qCDebug(taskUploadLogC) << getUid().toString() << "Upload failed to finalize:" << m_url.toString();
|
qCDebug(taskUploadLogC) << getUid().toString() << "Upload failed to finalize:" << m_url.toString();
|
||||||
m_sink->abort();
|
m_sink->abort();
|
||||||
m_reply.reset();
|
m_reply.reset();
|
||||||
emitFailed("");
|
emit failed("");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_reply.reset();
|
m_reply.reset();
|
||||||
qCDebug(taskUploadLogC) << getUid().toString() << "Upload succeeded:" << m_url.toString();
|
qCDebug(taskUploadLogC) << getUid().toString() << "Upload succeeded:" << m_url.toString();
|
||||||
emitSucceeded();
|
emit succeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Upload::downloadReadyRead()
|
void Upload::downloadReadyRead()
|
||||||
@ -208,7 +208,7 @@ void Upload::executeTask()
|
|||||||
|
|
||||||
if (m_state == State::AbortedByUser) {
|
if (m_state == State::AbortedByUser) {
|
||||||
qCWarning(taskUploadLogC) << getUid().toString() << "Attempt to start an aborted Upload:" << m_url.toString();
|
qCWarning(taskUploadLogC) << getUid().toString() << "Attempt to start an aborted Upload:" << m_url.toString();
|
||||||
emitAborted();
|
emit aborted();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QNetworkRequest request(m_url);
|
QNetworkRequest request(m_url);
|
||||||
|
Loading…
Reference in New Issue
Block a user