acquire-worker.cc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: acquire-worker.cc,v 1.34 2001/05/22 04:42:54 jgg Exp $
  4. /* ######################################################################
  5. Acquire Worker
  6. The worker process can startup either as a Configuration prober
  7. or as a queue runner. As a configuration prober it only reads the
  8. configuration message and
  9. ##################################################################### */
  10. /*}}}*/
  11. // Include Files /*{{{*/
  12. #include <config.h>
  13. #include <apt-pkg/acquire.h>
  14. #include <apt-pkg/acquire-worker.h>
  15. #include <apt-pkg/acquire-item.h>
  16. #include <apt-pkg/configuration.h>
  17. #include <apt-pkg/error.h>
  18. #include <apt-pkg/fileutl.h>
  19. #include <apt-pkg/strutl.h>
  20. #include <apt-pkg/hashes.h>
  21. #include <string>
  22. #include <vector>
  23. #include <iostream>
  24. #include <sstream>
  25. #include <sys/stat.h>
  26. #include <stdlib.h>
  27. #include <unistd.h>
  28. #include <signal.h>
  29. #include <stdio.h>
  30. #include <errno.h>
  31. #include <sys/types.h>
  32. #include <pwd.h>
  33. #include <grp.h>
  34. #include <apti18n.h>
  35. /*}}}*/
  36. using namespace std;
  37. // Worker::Worker - Constructor for Queue startup /*{{{*/
  38. // ---------------------------------------------------------------------
  39. /* */
  40. pkgAcquire::Worker::Worker(Queue *Q,MethodConfig *Cnf,
  41. pkgAcquireStatus *Log) : Log(Log)
  42. {
  43. OwnerQ = Q;
  44. Config = Cnf;
  45. Access = Cnf->Access;
  46. CurrentItem = 0;
  47. TotalSize = 0;
  48. CurrentSize = 0;
  49. Construct();
  50. }
  51. /*}}}*/
  52. // Worker::Worker - Constructor for method config startup /*{{{*/
  53. // ---------------------------------------------------------------------
  54. /* */
  55. pkgAcquire::Worker::Worker(MethodConfig *Cnf)
  56. {
  57. OwnerQ = 0;
  58. Config = Cnf;
  59. Access = Cnf->Access;
  60. CurrentItem = 0;
  61. TotalSize = 0;
  62. CurrentSize = 0;
  63. Construct();
  64. }
  65. /*}}}*/
  66. // Worker::Construct - Constructor helper /*{{{*/
  67. // ---------------------------------------------------------------------
  68. /* */
  69. void pkgAcquire::Worker::Construct()
  70. {
  71. NextQueue = 0;
  72. NextAcquire = 0;
  73. Process = -1;
  74. InFd = -1;
  75. OutFd = -1;
  76. OutReady = false;
  77. InReady = false;
  78. Debug = _config->FindB("Debug::pkgAcquire::Worker",false);
  79. }
  80. /*}}}*/
  81. // Worker::~Worker - Destructor /*{{{*/
  82. // ---------------------------------------------------------------------
  83. /* */
  84. pkgAcquire::Worker::~Worker()
  85. {
  86. close(InFd);
  87. close(OutFd);
  88. if (Process > 0)
  89. {
  90. /* Closing of stdin is the signal to exit and die when the process
  91. indicates it needs cleanup */
  92. if (Config->NeedsCleanup == false)
  93. kill(Process,SIGINT);
  94. ExecWait(Process,Access.c_str(),true);
  95. }
  96. }
  97. /*}}}*/
  98. // Worker::Start - Start the worker process /*{{{*/
  99. // ---------------------------------------------------------------------
  100. /* This forks the method and inits the communication channel */
  101. bool pkgAcquire::Worker::Start()
  102. {
  103. // Get the method path
  104. string Method = _config->FindDir("Dir::Bin::Methods") + Access;
  105. if (FileExists(Method) == false)
  106. {
  107. _error->Error(_("The method driver %s could not be found."),Method.c_str());
  108. if (Access == "https")
  109. _error->Notice(_("Is the package %s installed?"), "apt-transport-https");
  110. return false;
  111. }
  112. if (Debug == true)
  113. clog << "Starting method '" << Method << '\'' << endl;
  114. // Create the pipes
  115. int Pipes[4] = {-1,-1,-1,-1};
  116. if (pipe(Pipes) != 0 || pipe(Pipes+2) != 0)
  117. {
  118. _error->Errno("pipe","Failed to create IPC pipe to subprocess");
  119. for (int I = 0; I != 4; I++)
  120. close(Pipes[I]);
  121. return false;
  122. }
  123. for (int I = 0; I != 4; I++)
  124. SetCloseExec(Pipes[I],true);
  125. // Fork off the process
  126. Process = ExecFork();
  127. if (Process == 0)
  128. {
  129. // Setup the FDs
  130. dup2(Pipes[1],STDOUT_FILENO);
  131. dup2(Pipes[2],STDIN_FILENO);
  132. SetCloseExec(STDOUT_FILENO,false);
  133. SetCloseExec(STDIN_FILENO,false);
  134. SetCloseExec(STDERR_FILENO,false);
  135. const char *Args[2];
  136. Args[0] = Method.c_str();
  137. Args[1] = 0;
  138. execv(Args[0],(char **)Args);
  139. cerr << "Failed to exec method " << Args[0] << endl;
  140. _exit(100);
  141. }
  142. // Fix up our FDs
  143. InFd = Pipes[0];
  144. OutFd = Pipes[3];
  145. SetNonBlock(Pipes[0],true);
  146. SetNonBlock(Pipes[3],true);
  147. close(Pipes[1]);
  148. close(Pipes[2]);
  149. OutReady = false;
  150. InReady = true;
  151. // Read the configuration data
  152. if (WaitFd(InFd) == false ||
  153. ReadMessages() == false)
  154. return _error->Error(_("Method %s did not start correctly"),Method.c_str());
  155. RunMessages();
  156. if (OwnerQ != 0)
  157. SendConfiguration();
  158. return true;
  159. }
  160. /*}}}*/
  161. // Worker::ReadMessages - Read all pending messages into the list /*{{{*/
  162. // ---------------------------------------------------------------------
  163. /* */
  164. bool pkgAcquire::Worker::ReadMessages()
  165. {
  166. if (::ReadMessages(InFd,MessageQueue) == false)
  167. return MethodFailure();
  168. return true;
  169. }
  170. /*}}}*/
  171. // Worker::RunMessage - Empty the message queue /*{{{*/
  172. // ---------------------------------------------------------------------
  173. /* This takes the messages from the message queue and runs them through
  174. the parsers in order. */
  175. bool pkgAcquire::Worker::RunMessages()
  176. {
  177. while (MessageQueue.empty() == false)
  178. {
  179. string Message = MessageQueue.front();
  180. MessageQueue.erase(MessageQueue.begin());
  181. if (Debug == true)
  182. clog << " <- " << Access << ':' << QuoteString(Message,"\n") << endl;
  183. // Fetch the message number
  184. char *End;
  185. int Number = strtol(Message.c_str(),&End,10);
  186. if (End == Message.c_str())
  187. return _error->Error("Invalid message from method %s: %s",Access.c_str(),Message.c_str());
  188. string URI = LookupTag(Message,"URI");
  189. pkgAcquire::Queue::QItem *Itm = 0;
  190. if (URI.empty() == false)
  191. Itm = OwnerQ->FindItem(URI,this);
  192. // update used mirror
  193. string UsedMirror = LookupTag(Message,"UsedMirror", "");
  194. if (!UsedMirror.empty() &&
  195. Itm &&
  196. Itm->Description.find(" ") != string::npos)
  197. {
  198. Itm->Description.replace(0, Itm->Description.find(" "), UsedMirror);
  199. // FIXME: will we need this as well?
  200. //Itm->ShortDesc = UsedMirror;
  201. }
  202. // Determine the message number and dispatch
  203. switch (Number)
  204. {
  205. // 100 Capabilities
  206. case 100:
  207. if (Capabilities(Message) == false)
  208. return _error->Error("Unable to process Capabilities message from %s",Access.c_str());
  209. break;
  210. // 101 Log
  211. case 101:
  212. if (Debug == true)
  213. clog << " <- (log) " << LookupTag(Message,"Message") << endl;
  214. break;
  215. // 102 Status
  216. case 102:
  217. Status = LookupTag(Message,"Message");
  218. break;
  219. // 103 Redirect
  220. case 103:
  221. {
  222. if (Itm == 0)
  223. {
  224. _error->Error("Method gave invalid 103 Redirect message");
  225. break;
  226. }
  227. string NewURI = LookupTag(Message,"New-URI",URI.c_str());
  228. Itm->URI = NewURI;
  229. ItemDone();
  230. pkgAcquire::Item *Owner = Itm->Owner;
  231. pkgAcquire::ItemDesc Desc = *Itm;
  232. // Change the status so that it can be dequeued
  233. Owner->Status = pkgAcquire::Item::StatIdle;
  234. // Mark the item as done (taking care of all queues)
  235. // and then put it in the main queue again
  236. OwnerQ->ItemDone(Itm);
  237. OwnerQ->Owner->Enqueue(Desc);
  238. if (Log != 0)
  239. Log->Done(Desc);
  240. break;
  241. }
  242. // 200 URI Start
  243. case 200:
  244. {
  245. if (Itm == 0)
  246. {
  247. _error->Error("Method gave invalid 200 URI Start message");
  248. break;
  249. }
  250. CurrentItem = Itm;
  251. CurrentSize = 0;
  252. TotalSize = strtoull(LookupTag(Message,"Size","0").c_str(), NULL, 10);
  253. ResumePoint = strtoull(LookupTag(Message,"Resume-Point","0").c_str(), NULL, 10);
  254. Itm->Owner->Start(Message,strtoull(LookupTag(Message,"Size","0").c_str(), NULL, 10));
  255. // Display update before completion
  256. if (Log != 0 && Log->MorePulses == true)
  257. Log->Pulse(Itm->Owner->GetOwner());
  258. if (Log != 0)
  259. Log->Fetch(*Itm);
  260. break;
  261. }
  262. // 201 URI Done
  263. case 201:
  264. {
  265. if (Itm == 0)
  266. {
  267. _error->Error("Method gave invalid 201 URI Done message");
  268. break;
  269. }
  270. pkgAcquire::Item *Owner = Itm->Owner;
  271. pkgAcquire::ItemDesc Desc = *Itm;
  272. if (RealFileExists(Owner->DestFile))
  273. ChangeOwnerAndPermissionOfFile("201::URIDone", Owner->DestFile.c_str(), "root", "root", 0644);
  274. // Display update before completion
  275. if (Log != 0 && Log->MorePulses == true)
  276. Log->Pulse(Owner->GetOwner());
  277. OwnerQ->ItemDone(Itm);
  278. unsigned long long const ServerSize = strtoull(LookupTag(Message,"Size","0").c_str(), NULL, 10);
  279. bool isHit = StringToBool(LookupTag(Message,"IMS-Hit"),false) ||
  280. StringToBool(LookupTag(Message,"Alt-IMS-Hit"),false);
  281. // Using the https method the server might return 200, but the
  282. // If-Modified-Since condition is not satsified, libcurl will
  283. // discard the download. In this case, however, TotalSize will be
  284. // set to the actual size of the file, while ServerSize will be set
  285. // to 0. Therefore, if the item is marked as a hit and the
  286. // downloaded size (ServerSize) is 0, we ignore TotalSize.
  287. if (TotalSize != 0 && (!isHit || ServerSize != 0) && ServerSize != TotalSize)
  288. _error->Warning("Size of file %s is not what the server reported %s %llu",
  289. Owner->DestFile.c_str(), LookupTag(Message,"Size","0").c_str(),TotalSize);
  290. // see if there is a hash to verify
  291. HashStringList ReceivedHashes;
  292. HashStringList expectedHashes = Owner->HashSums();
  293. for (HashStringList::const_iterator hs = expectedHashes.begin(); hs != expectedHashes.end(); ++hs)
  294. {
  295. std::string const tagname = hs->HashType() + "-Hash";
  296. std::string const hashsum = LookupTag(Message, tagname.c_str());
  297. if (hashsum.empty() == false)
  298. ReceivedHashes.push_back(HashString(hs->HashType(), hashsum));
  299. }
  300. if(_config->FindB("Debug::pkgAcquire::Auth", false) == true)
  301. {
  302. std::clog << "201 URI Done: " << Owner->DescURI() << endl
  303. << "ReceivedHash:" << endl;
  304. for (HashStringList::const_iterator hs = ReceivedHashes.begin(); hs != ReceivedHashes.end(); ++hs)
  305. std::clog << "\t- " << hs->toStr() << std::endl;
  306. std::clog << "ExpectedHash:" << endl;
  307. for (HashStringList::const_iterator hs = expectedHashes.begin(); hs != expectedHashes.end(); ++hs)
  308. std::clog << "\t- " << hs->toStr() << std::endl;
  309. std::clog << endl;
  310. }
  311. Owner->Done(Message, ServerSize, ReceivedHashes, Config);
  312. ItemDone();
  313. // Log that we are done
  314. if (Log != 0)
  315. {
  316. if (isHit)
  317. {
  318. /* Hide 'hits' for local only sources - we also manage to
  319. hide gets */
  320. if (Config->LocalOnly == false)
  321. Log->IMSHit(Desc);
  322. }
  323. else
  324. Log->Done(Desc);
  325. }
  326. break;
  327. }
  328. // 400 URI Failure
  329. case 400:
  330. {
  331. if (Itm == 0)
  332. {
  333. std::string const msg = LookupTag(Message,"Message");
  334. _error->Error("Method gave invalid 400 URI Failure message: %s", msg.c_str());
  335. break;
  336. }
  337. // Display update before completion
  338. if (Log != 0 && Log->MorePulses == true)
  339. Log->Pulse(Itm->Owner->GetOwner());
  340. pkgAcquire::Item *Owner = Itm->Owner;
  341. pkgAcquire::ItemDesc Desc = *Itm;
  342. if (RealFileExists(Owner->DestFile))
  343. ChangeOwnerAndPermissionOfFile("400::URIFailure", Owner->DestFile.c_str(), "root", "root", 0644);
  344. OwnerQ->ItemDone(Itm);
  345. // set some status
  346. if(LookupTag(Message,"FailReason") == "Timeout" ||
  347. LookupTag(Message,"FailReason") == "TmpResolveFailure" ||
  348. LookupTag(Message,"FailReason") == "ResolveFailure" ||
  349. LookupTag(Message,"FailReason") == "ConnectionRefused")
  350. Owner->Status = pkgAcquire::Item::StatTransientNetworkError;
  351. Owner->Failed(Message,Config);
  352. ItemDone();
  353. if (Log != 0)
  354. Log->Fail(Desc);
  355. break;
  356. }
  357. // 401 General Failure
  358. case 401:
  359. _error->Error("Method %s General failure: %s",Access.c_str(),LookupTag(Message,"Message").c_str());
  360. break;
  361. // 403 Media Change
  362. case 403:
  363. MediaChange(Message);
  364. break;
  365. }
  366. }
  367. return true;
  368. }
  369. /*}}}*/
  370. // Worker::Capabilities - 100 Capabilities handler /*{{{*/
  371. // ---------------------------------------------------------------------
  372. /* This parses the capabilities message and dumps it into the configuration
  373. structure. */
  374. bool pkgAcquire::Worker::Capabilities(string Message)
  375. {
  376. if (Config == 0)
  377. return true;
  378. Config->Version = LookupTag(Message,"Version");
  379. Config->SingleInstance = StringToBool(LookupTag(Message,"Single-Instance"),false);
  380. Config->Pipeline = StringToBool(LookupTag(Message,"Pipeline"),false);
  381. Config->SendConfig = StringToBool(LookupTag(Message,"Send-Config"),false);
  382. Config->LocalOnly = StringToBool(LookupTag(Message,"Local-Only"),false);
  383. Config->NeedsCleanup = StringToBool(LookupTag(Message,"Needs-Cleanup"),false);
  384. Config->Removable = StringToBool(LookupTag(Message,"Removable"),false);
  385. // Some debug text
  386. if (Debug == true)
  387. {
  388. clog << "Configured access method " << Config->Access << endl;
  389. clog << "Version:" << Config->Version <<
  390. " SingleInstance:" << Config->SingleInstance <<
  391. " Pipeline:" << Config->Pipeline <<
  392. " SendConfig:" << Config->SendConfig <<
  393. " LocalOnly: " << Config->LocalOnly <<
  394. " NeedsCleanup: " << Config->NeedsCleanup <<
  395. " Removable: " << Config->Removable << endl;
  396. }
  397. return true;
  398. }
  399. /*}}}*/
  400. // Worker::MediaChange - Request a media change /*{{{*/
  401. // ---------------------------------------------------------------------
  402. /* */
  403. bool pkgAcquire::Worker::MediaChange(string Message)
  404. {
  405. int status_fd = _config->FindI("APT::Status-Fd",-1);
  406. if(status_fd > 0)
  407. {
  408. string Media = LookupTag(Message,"Media");
  409. string Drive = LookupTag(Message,"Drive");
  410. ostringstream msg,status;
  411. ioprintf(msg,_("Please insert the disc labeled: "
  412. "'%s' "
  413. "in the drive '%s' and press enter."),
  414. Media.c_str(),Drive.c_str());
  415. status << "media-change: " // message
  416. << Media << ":" // media
  417. << Drive << ":" // drive
  418. << msg.str() // l10n message
  419. << endl;
  420. std::string const dlstatus = status.str();
  421. FileFd::Write(status_fd, dlstatus.c_str(), dlstatus.size());
  422. }
  423. if (Log == 0 || Log->MediaChange(LookupTag(Message,"Media"),
  424. LookupTag(Message,"Drive")) == false)
  425. {
  426. char S[300];
  427. snprintf(S,sizeof(S),"603 Media Changed\nFailed: true\n\n");
  428. if (Debug == true)
  429. clog << " -> " << Access << ':' << QuoteString(S,"\n") << endl;
  430. OutQueue += S;
  431. OutReady = true;
  432. return true;
  433. }
  434. char S[300];
  435. snprintf(S,sizeof(S),"603 Media Changed\n\n");
  436. if (Debug == true)
  437. clog << " -> " << Access << ':' << QuoteString(S,"\n") << endl;
  438. OutQueue += S;
  439. OutReady = true;
  440. return true;
  441. }
  442. /*}}}*/
  443. // Worker::SendConfiguration - Send the config to the method /*{{{*/
  444. // ---------------------------------------------------------------------
  445. /* */
  446. bool pkgAcquire::Worker::SendConfiguration()
  447. {
  448. if (Config->SendConfig == false)
  449. return true;
  450. if (OutFd == -1)
  451. return false;
  452. /* Write out all of the configuration directives by walking the
  453. configuration tree */
  454. std::ostringstream Message;
  455. Message << "601 Configuration\n";
  456. _config->Dump(Message, NULL, "Config-Item: %F=%V\n", false);
  457. Message << '\n';
  458. if (Debug == true)
  459. clog << " -> " << Access << ':' << QuoteString(Message.str(),"\n") << endl;
  460. OutQueue += Message.str();
  461. OutReady = true;
  462. return true;
  463. }
  464. /*}}}*/
  465. // Worker::QueueItem - Add an item to the outbound queue /*{{{*/
  466. // ---------------------------------------------------------------------
  467. /* Send a URI Acquire message to the method */
  468. bool pkgAcquire::Worker::QueueItem(pkgAcquire::Queue::QItem *Item)
  469. {
  470. if (OutFd == -1)
  471. return false;
  472. string Message = "600 URI Acquire\n";
  473. Message.reserve(300);
  474. Message += "URI: " + Item->URI;
  475. Message += "\nFilename: " + Item->Owner->DestFile;
  476. HashStringList const hsl = Item->Owner->HashSums();
  477. for (HashStringList::const_iterator hs = hsl.begin(); hs != hsl.end(); ++hs)
  478. Message += "\nExpected-" + hs->HashType() + ": " + hs->HashValue();
  479. if(Item->Owner->FileSize > 0)
  480. {
  481. string MaximumSize;
  482. strprintf(MaximumSize, "%llu", Item->Owner->FileSize);
  483. Message += "\nMaximum-Size: " + MaximumSize;
  484. }
  485. Message += Item->Owner->Custom600Headers();
  486. Message += "\n\n";
  487. if (RealFileExists(Item->Owner->DestFile))
  488. {
  489. std::string SandboxUser = _config->Find("APT::Sandbox::User");
  490. ChangeOwnerAndPermissionOfFile("Item::QueueURI", Item->Owner->DestFile.c_str(),
  491. SandboxUser.c_str(), "root", 0600);
  492. }
  493. if (Debug == true)
  494. clog << " -> " << Access << ':' << QuoteString(Message,"\n") << endl;
  495. OutQueue += Message;
  496. OutReady = true;
  497. return true;
  498. }
  499. /*}}}*/
  500. // Worker::OutFdRead - Out bound FD is ready /*{{{*/
  501. // ---------------------------------------------------------------------
  502. /* */
  503. bool pkgAcquire::Worker::OutFdReady()
  504. {
  505. int Res;
  506. do
  507. {
  508. Res = write(OutFd,OutQueue.c_str(),OutQueue.length());
  509. }
  510. while (Res < 0 && errno == EINTR);
  511. if (Res <= 0)
  512. return MethodFailure();
  513. OutQueue.erase(0,Res);
  514. if (OutQueue.empty() == true)
  515. OutReady = false;
  516. return true;
  517. }
  518. /*}}}*/
  519. // Worker::InFdRead - In bound FD is ready /*{{{*/
  520. // ---------------------------------------------------------------------
  521. /* */
  522. bool pkgAcquire::Worker::InFdReady()
  523. {
  524. if (ReadMessages() == false)
  525. return false;
  526. RunMessages();
  527. return true;
  528. }
  529. /*}}}*/
  530. // Worker::MethodFailure - Called when the method fails /*{{{*/
  531. // ---------------------------------------------------------------------
  532. /* This is called when the method is believed to have failed, probably because
  533. read returned -1. */
  534. bool pkgAcquire::Worker::MethodFailure()
  535. {
  536. _error->Error("Method %s has died unexpectedly!",Access.c_str());
  537. // do not reap the child here to show meaningfull error to the user
  538. ExecWait(Process,Access.c_str(),false);
  539. Process = -1;
  540. close(InFd);
  541. close(OutFd);
  542. InFd = -1;
  543. OutFd = -1;
  544. OutReady = false;
  545. InReady = false;
  546. OutQueue = string();
  547. MessageQueue.erase(MessageQueue.begin(),MessageQueue.end());
  548. return false;
  549. }
  550. /*}}}*/
  551. // Worker::Pulse - Called periodically /*{{{*/
  552. // ---------------------------------------------------------------------
  553. /* */
  554. void pkgAcquire::Worker::Pulse()
  555. {
  556. if (CurrentItem == 0)
  557. return;
  558. struct stat Buf;
  559. if (stat(CurrentItem->Owner->DestFile.c_str(),&Buf) != 0)
  560. return;
  561. CurrentSize = Buf.st_size;
  562. // Hmm? Should not happen...
  563. if (CurrentSize > TotalSize && TotalSize != 0)
  564. TotalSize = CurrentSize;
  565. }
  566. /*}}}*/
  567. // Worker::ItemDone - Called when the current item is finished /*{{{*/
  568. // ---------------------------------------------------------------------
  569. /* */
  570. void pkgAcquire::Worker::ItemDone()
  571. {
  572. CurrentItem = 0;
  573. CurrentSize = 0;
  574. TotalSize = 0;
  575. Status = string();
  576. }
  577. /*}}}*/