From c03462c6fed27e26b2bab4b3b34589fa8bf464f8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 17 Apr 2007 15:33:19 +0200 Subject: * [ABI] apt-pkg/acquire.{cc,h}: - deal better with duplicated sources.list entries (avoid double queuing of URLs) - this fixes hangs in bzip/gzip --- apt-pkg/acquire.cc | 19 +++++++++++++------ apt-pkg/acquire.h | 2 +- apt-pkg/init.h | 2 +- apt-pkg/makefile | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index fff1b2b6a..e1dccf25a 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -193,9 +193,9 @@ void pkgAcquire::Enqueue(ItemDesc &Item) Item.Owner->Status = Item::StatIdle; // Queue it into the named queue - I->Enqueue(Item); - ToFetch++; - + if(I->Enqueue(Item)) + ToFetch++; + // Some trace stuff if (Debug == true) { @@ -549,11 +549,17 @@ pkgAcquire::Queue::~Queue() // Queue::Enqueue - Queue an item to the queue /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcquire::Queue::Enqueue(ItemDesc &Item) +bool pkgAcquire::Queue::Enqueue(ItemDesc &Item) { QItem **I = &Items; - for (; *I != 0; I = &(*I)->Next); - + // move to the end of the queue and check for duplicates here + for (; *I != 0; I = &(*I)->Next) + if (Item.URI == (*I)->URI) + { + Item.Owner->Status = Item::StatDone; + return false; + } + // Create a new item QItem *Itm = new QItem; *Itm = Item; @@ -563,6 +569,7 @@ void pkgAcquire::Queue::Enqueue(ItemDesc &Item) Item.Owner->QueueCounter++; if (Items->Next == 0) Cycle(); + return true; } /*}}}*/ // Queue::Dequeue - Remove an item from the queue /*{{{*/ diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 27bb3d363..1d5daf12e 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -173,7 +173,7 @@ class pkgAcquire::Queue public: // Put an item into this queue - void Enqueue(ItemDesc &Item); + bool Enqueue(ItemDesc &Item); bool Dequeue(Item *Owner); // Find a Queued item diff --git a/apt-pkg/init.h b/apt-pkg/init.h index 8255b406a..b584b2cce 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -18,7 +18,7 @@ // See the makefile #define APT_PKG_MAJOR 3 -#define APT_PKG_MINOR 11 +#define APT_PKG_MINOR 12 #define APT_PKG_RELEASE 0 extern const char *pkgVersion; diff --git a/apt-pkg/makefile b/apt-pkg/makefile index 7e5feae53..c493d3dd9 100644 --- a/apt-pkg/makefile +++ b/apt-pkg/makefile @@ -13,7 +13,7 @@ include ../buildlib/defaults.mak # methods/makefile - FIXME LIBRARY=apt-pkg LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER) -MAJOR=3.11 +MAJOR=3.12 MINOR=0 SLIBS=$(PTHREADLIB) $(INTLLIBS) APT_DOMAIN:=libapt-pkg$(MAJOR) -- cgit v1.2.3