summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Pinkham <cpinkham@mythtv.org>2010-12-16 15:56:04 (GMT)
committer Chris Pinkham <cpinkham@mythtv.org>2010-12-16 15:56:04 (GMT)
commitfc8e5eeaee31feaac24cbffaf5a94f33302a3b04 (patch)
tree282d54ddea0098362ad7590eb6d6af53c9f5f960
parent271c60a5d4428475cbcc502ad49ac033c2840f9a (diff)
MythDownloadManager timeout change and error handling.
- Change the downloadNow() timeout to 10 seconds instead of 20. - If a downloadNow() request times out, abort the download and set a flag which allows the downloadInfo instance to be cleaned up by the regular event handlers.
-rw-r--r--mythtv/libs/libmythdb/mythdownloadmanager.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/mythtv/libs/libmythdb/mythdownloadmanager.cpp b/mythtv/libs/libmythdb/mythdownloadmanager.cpp
index faee531..8b765e7 100644
--- a/mythtv/libs/libmythdb/mythdownloadmanager.cpp
+++ b/mythtv/libs/libmythdb/mythdownloadmanager.cpp
@@ -613,10 +613,10 @@ bool MythDownloadManager::downloadNow(MythDownloadInfo *dlInfo, bool deleteInfo)
m_infoLock->unlock();
m_queueWaitCond.wakeAll();
- // sleep for 200ms at a time for up to 20 seconds waiting for the download
+ // sleep for 200ms at a time for up to 10 seconds waiting for the download
m_infoLock->lock();
while ((!dlInfo->m_done) &&
- (dlInfo->m_lastStat.secsTo(QDateTime::currentDateTime()) < 20))
+ (dlInfo->m_lastStat.secsTo(QDateTime::currentDateTime()) < 10))
{
m_infoLock->unlock();
m_queueWaitLock.lock();
@@ -624,14 +624,21 @@ bool MythDownloadManager::downloadNow(MythDownloadInfo *dlInfo, bool deleteInfo)
m_queueWaitLock.unlock();
m_infoLock->lock();
}
- m_infoLock->unlock();
bool success =
dlInfo->m_done && (dlInfo->m_errorCode == QNetworkReply::NoError);
- if (deleteInfo)
+ if (!dlInfo->m_done)
+ {
+ dlInfo->m_syncMode = false; // Let downloadFinished() cleanup for us
+ if (dlInfo->m_reply)
+ dlInfo->m_reply->abort();
+ }
+ else if (deleteInfo)
delete dlInfo;
+ m_infoLock->unlock();
+
return success;
}