Sfoglia il codice sorgente

Fixed some bugs in the progress reporting
Author: jgg
Date: 1999-06-06 06:58:36 GMT
Fixed some bugs in the progress reporting

Arch Librarian 22 anni fa
parent
commit
aa0e1101d7
2 ha cambiato i file con 18 aggiunte e 6 eliminazioni
  1. 4 1
      apt-pkg/acquire-item.cc
  2. 14 5
      apt-pkg/acquire.cc

+ 4 - 1
apt-pkg/acquire-item.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: acquire-item.cc,v 1.31 1999/06/05 04:33:29 jgg Exp $
+// $Id: acquire-item.cc,v 1.32 1999/06/06 06:58:36 jgg Exp $
 /* ######################################################################
 /* ######################################################################
 
 
    Acquire Item - Item to acquire
    Acquire Item - Item to acquire
@@ -97,6 +97,9 @@ void pkgAcquire::Item::Done(string Message,unsigned long Size,string)
       if (Owner->Log != 0)
       if (Owner->Log != 0)
 	 Owner->Log->Fetched(Size,atoi(LookupTag(Message,"Resume-Point","0").c_str()));
 	 Owner->Log->Fetched(Size,atoi(LookupTag(Message,"Resume-Point","0").c_str()));
    }
    }
+
+   if (FileSize == 0)
+      FileSize= Size;
    
    
    Status = StatDone;
    Status = StatDone;
    ErrorText = string();
    ErrorText = string();

+ 14 - 5
apt-pkg/acquire.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: acquire.cc,v 1.34 1999/05/24 03:39:37 jgg Exp $
+// $Id: acquire.cc,v 1.35 1999/06/06 06:58:36 jgg Exp $
 /* ######################################################################
 /* ######################################################################
 
 
    Acquire - File Acquiration
    Acquire - File Acquiration
@@ -704,11 +704,20 @@ void pkgAcquireStatus::Pulse(pkgAcquire *Owner)
    }
    }
    
    
    // Compute the current completion
    // Compute the current completion
+   unsigned long ResumeSize = 0;
    for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
    for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
 	I = Owner->WorkerStep(I))
 	I = Owner->WorkerStep(I))
       if (I->CurrentItem != 0 && I->CurrentItem->Owner->Complete == false)
       if (I->CurrentItem != 0 && I->CurrentItem->Owner->Complete == false)
-	 CurrentBytes += I->CurrentSize - I->ResumePoint;
-      
+      {
+	 CurrentBytes += I->CurrentSize;
+	 ResumeSize += I->ResumePoint;
+	 
+	 // Files with unknown size always have 100% completion
+	 if (I->CurrentItem->Owner->FileSize == 0 && 
+	     I->CurrentItem->Owner->Complete == false)
+	    TotalBytes += I->CurrentSize;
+      }
+   
    // Normalize the figures and account for unknown size downloads
    // Normalize the figures and account for unknown size downloads
    if (TotalBytes <= 0)
    if (TotalBytes <= 0)
       TotalBytes = 1;
       TotalBytes = 1;
@@ -728,8 +737,8 @@ void pkgAcquireStatus::Pulse(pkgAcquire *Owner)
       if (Delta < 0.01)
       if (Delta < 0.01)
 	 CurrentCPS = 0;
 	 CurrentCPS = 0;
       else
       else
-	 CurrentCPS = (CurrentBytes - LastBytes)/Delta;
-      LastBytes = CurrentBytes;
+	 CurrentCPS = ((CurrentBytes - ResumeSize) - LastBytes)/Delta;
+      LastBytes = CurrentBytes - ResumeSize;
       ElapsedTime = (unsigned long)Delta;
       ElapsedTime = (unsigned long)Delta;
       Time = NewTime;
       Time = NewTime;
    }
    }