diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:51:20 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:51:20 +0000 |
commit | bfd22fc0ac2632c6196f5149dc3b3671d9ff15e0 (patch) | |
tree | 2affe097f22065e344d2fc8921049ea7e3185d9b /apt-pkg/acquire.cc | |
parent | 46976ca4e7393625fb25728d876e0c15b7e55c15 (diff) |
Working acquire code
Author: jgg
Date: 1998-11-05 07:21:35 GMT
Working acquire code
Diffstat (limited to 'apt-pkg/acquire.cc')
-rw-r--r-- | apt-pkg/acquire.cc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 91b2a7590..16adf3ae2 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire.cc,v 1.7 1998/11/01 05:27:34 jgg Exp $ +// $Id: acquire.cc,v 1.8 1998/11/05 07:21:40 jgg Exp $ /* ###################################################################### Acquire - File Acquiration @@ -143,6 +143,8 @@ void pkgAcquire::Enqueue(Item *Itm,string URI,string Description) if (Running == true) I->Startup(); } + + Itm->Status = Item::StatIdle; // Queue it into the named queue I->Enqueue(Itm,URI,Description); @@ -164,12 +166,14 @@ void pkgAcquire::Enqueue(Item *Itm,string URI,string Description) void pkgAcquire::Dequeue(Item *Itm) { Queue *I = Queues; + bool Res = false; for (; I != 0; I = I->Next) - I->Dequeue(Itm); + Res |= I->Dequeue(Itm); if (Debug == true) clog << "Dequeuing " << Itm->DestFile << endl; - ToFetch--; + if (Res == true) + ToFetch--; } /*}}}*/ // Acquire::QueueName - Return the name of the queue for this URI /*{{{*/ @@ -371,9 +375,11 @@ void pkgAcquire::Queue::Enqueue(Item *Owner,string URI,string Description) /*}}}*/ // Queue::Dequeue - Remove an item from the queue /*{{{*/ // --------------------------------------------------------------------- -/* */ -void pkgAcquire::Queue::Dequeue(Item *Owner) +/* We return true if we hit something*/ +bool pkgAcquire::Queue::Dequeue(Item *Owner) { + bool Res = false; + QItem **I = &Items; for (; *I != 0;) { @@ -383,10 +389,13 @@ void pkgAcquire::Queue::Dequeue(Item *Owner) *I = (*I)->Next; Owner->QueueCounter--; delete Jnk; + Res = true; } else I = &(*I)->Next; } + + return Res; } /*}}}*/ // Queue::Startup - Start the worker processes /*{{{*/ @@ -463,6 +472,8 @@ bool pkgAcquire::Queue::Cycle() if (Items == 0 || Workers == 0) return true; + cout << "Cylce for " << Name << endl; + // Look for a queable item QItem *I = Items; for (; I != 0; I = I->Next) @@ -475,6 +486,7 @@ bool pkgAcquire::Queue::Cycle() I->Worker = Workers; I->Owner->Status = pkgAcquire::Item::StatFetching; + cout << "Item has been queued!" << endl; return Workers->QueueItem(I); } /*}}}*/ |