Implemented incremental retry download timer.
authorRoman Moravcik <roman.moravcik@gmail.com>
Fri, 4 Mar 2011 08:16:26 +0000 (09:16 +0100)
committerRoman Moravcik <roman.moravcik@gmail.com>
Fri, 4 Mar 2011 08:16:26 +0000 (09:16 +0100)
src/medarddownloader.cpp

index 06f952f..6e8de0c 100644 (file)
@@ -46,6 +46,7 @@
 #define IMAGE_HEIGHT 408
 
 #define MAX_DOWNLOAD_RETRIES 3
+#define RETRY_TIMEOUT 5000
 
 MedardDownloader::MedardDownloader() : QObject()
 {
@@ -59,7 +60,6 @@ MedardDownloader::MedardDownloader() : QObject()
 
     m_retryCounter = 0;
     m_retryTimer = new QTimer();
-    m_retryTimer->setInterval(5000);
     connect(m_retryTimer, SIGNAL(timeout()), this, SLOT(retryTimerEvent()));
 
     m_cachePath = QString("%1/%2")
@@ -191,6 +191,7 @@ void MedardDownloader::tryDownloadImageAgain()
     m_retryCounter++;
 
     if (m_retryCounter < MAX_DOWNLOAD_RETRIES) {
+        m_retryTimer->setInterval(RETRY_TIMEOUT * (m_retryCounter + 1));
         m_retryTimer->start();
     } else {
         m_retryCounter = 0;