1
0
Fork 0
forked from len0rd/rockbox

Only create cache file when no error occured. Ignore server errors when using download cache to make offline mode work again.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17702 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2008-06-07 17:17:19 +00:00
parent 61f5dd623d
commit 2a4c0f5cb2

View file

@ -291,7 +291,7 @@ void HttpGet::httpDone(bool error)
if(!outputToBuffer) if(!outputToBuffer)
outputFile->close(); outputFile->close();
if(m_usecache && !m_cached) { if(m_usecache && !m_cached && !error) {
qDebug() << "[HTTP] creating cache file" << m_cachefile; qDebug() << "[HTTP] creating cache file" << m_cachefile;
QFile c(m_cachefile); QFile c(m_cachefile);
c.open(QIODevice::ReadWrite); c.open(QIODevice::ReadWrite);
@ -305,6 +305,10 @@ void HttpGet::httpDone(bool error)
c.close(); c.close();
} }
// if cached file found and cache enabled ignore http errors
if(m_usecache && m_cached && !http.hasPendingRequests()) {
error = false;
}
// take care of concurring requests. If there is still one running, // take care of concurring requests. If there is still one running,
// don't emit done(). That request will call this slot again. // don't emit done(). That request will call this slot again.
if(http.currentId() == 0 && !http.hasPendingRequests()) if(http.currentId() == 0 && !http.hasPendingRequests())