@@ -374,7 +374,7 @@ bool App::Download(const wxString& downloadPath, const Mirror *mirror)
374
374
DownloadThread *dt = new DownloadThread ();
375
375
if (dt == NULL )
376
376
{
377
- wxLogError (wxString::Format (_ (" Failed to create new DownloadThread " )));
377
+ wxLogError (wxString::Format (_ (" Failed to create new Download thread " )));
378
378
return false ;
379
379
}
380
380
@@ -397,12 +397,12 @@ bool App::Download(const wxString& downloadPath, const Mirror *mirror)
397
397
398
398
if (dt->Create () != wxTHREAD_NO_ERROR)
399
399
{
400
- wxLogError (wxString::Format (_ (" Failed to create Download Thread " )));
400
+ wxLogError (wxString::Format (_ (" Failed to create the Download thread " )));
401
401
return false ;
402
402
}
403
403
if (dt->Run () != wxTHREAD_NO_ERROR)
404
404
{
405
- wxLogError (wxString::Format (_ (" Couldn't initalise the downloading process " )));
405
+ wxLogError (wxString::Format (_ (" Failed to run the Download thread " )));
406
406
return false ;
407
407
}
408
408
@@ -413,7 +413,7 @@ bool App::Download(const wxString& downloadPath, const Mirror *mirror)
413
413
int kbDownloaded;
414
414
int kbFileSize;
415
415
wxString msg;
416
- bool isDownloadInProgress = false ;
416
+
417
417
/* setting this value will ensure download is in progress. */
418
418
dt->SetDownloadInProgress (true );
419
419
@@ -442,28 +442,15 @@ bool App::Download(const wxString& downloadPath, const Mirror *mirror)
442
442
kbFileSize = (int )dt->GetTotalFileSize () / KBSIZE;
443
443
kbDownloaded = (int )dt->GetTotalDownloadSize () / KBSIZE;
444
444
445
- if (isDownloadInProgress)
446
- {
447
- if ((kbFileSize == 0 ) && (kbDownloaded == 0 ))
448
- {
449
- // Sometime kbDownloaded does not add the last few bytes which causes
450
- // an infinite loop event though the file has completely downloaded
451
- isDownloadInProgress=false ;
452
- break ;
453
- }
454
- }
455
-
456
445
// To ignore initial few 0 values which is not updated
457
446
if ((kbFileSize == 0 ) || (kbDownloaded == 0 ))
458
447
continue ;
459
448
460
- isDownloadInProgress = true ;
461
-
462
449
if (kbFileSize > kbDownloaded)
463
450
msg = wxString::Format (_ (" Downloaded %d KB of %d KB (%ld KB/Sec)" ), kbDownloaded, kbFileSize, speed);
464
451
else
465
452
{
466
- msg = wxString::Format ( _ ( " Downloaded %6.0lf KB (%ld KB/Sec) " ), kbDownloaded, speed );
453
+ dt-> Kill ( );
467
454
break ;
468
455
}
469
456
0 commit comments