]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-worker.cc
Polish updated by Robert Luberda. Closes: #675603
[apt.git] / apt-pkg / acquire-worker.cc
index 8bc043c582bf855f393afc78d797546987cb92ad..9d90b08bce08df6b494472eb417fde71a449f101 100644 (file)
@@ -244,6 +244,21 @@ bool pkgAcquire::Worker::RunMessages()
  
             string NewURI = LookupTag(Message,"New-URI",URI.c_str());
             Itm->URI = NewURI;
+
+           ItemDone();
+
+           pkgAcquire::Item *Owner = Itm->Owner;
+           pkgAcquire::ItemDesc Desc = *Itm;
+
+           // Change the status so that it can be dequeued
+           Owner->Status = pkgAcquire::Item::StatIdle;
+           // Mark the item as done (taking care of all queues)
+           // and then put it in the main queue again
+           OwnerQ->ItemDone(Itm);
+           OwnerQ->Owner->Enqueue(Desc);
+
+           if (Log != 0)
+              Log->Done(Desc);
             break;
          }
    
@@ -511,10 +526,17 @@ bool pkgAcquire::Worker::QueueItem(pkgAcquire::Queue::QItem *Item)
 /* */
 bool pkgAcquire::Worker::OutFdReady()
 {
-   if (FileFd::Write(OutFd,OutQueue.c_str(),OutQueue.length()) == false)
+   int Res;
+   do
+   {
+      Res = write(OutFd,OutQueue.c_str(),OutQueue.length());
+   }
+   while (Res < 0 && errno == EINTR);
+
+   if (Res <= 0)
       return MethodFailure();
-   
-   OutQueue.clear();
+
+   OutQueue.erase(0,Res);
    if (OutQueue.empty() == true)
       OutReady = false;