diff options
Diffstat (limited to 'apt-pkg/acquire-worker.cc')
-rw-r--r-- | apt-pkg/acquire-worker.cc | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 75e03232a..5fa53db3d 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -105,13 +105,18 @@ pkgAcquire::Worker::~Worker() bool pkgAcquire::Worker::Start() { // Get the method path + std::cerr << "\n ---------------------------------------------------->>>" << std::endl; + std::cerr << " pkgAcquire::Worker::Start() starting the worker process" << std::endl; string Method = _config->FindDir("Dir::Bin::Methods") + Access; + std::cerr << " Method: " << Method << std::endl; + std::cerr << " Access: " << Access << std::endl; if (FileExists(Method) == false) return _error->Error(_("The method driver %s could not be found."),Method.c_str()); if (Debug == true) clog << "Starting method '" << Method << '\'' << endl; - + std::cerr << " Starting method '" << Method << '\'' << std::endl; + std::cerr << " creating the pipes." << std::endl; // Create the pipes int Pipes[4] = {-1,-1,-1,-1}; if (pipe(Pipes) != 0 || pipe(Pipes+2) != 0) @@ -123,7 +128,7 @@ bool pkgAcquire::Worker::Start() } for (int I = 0; I != 4; I++) SetCloseExec(Pipes[I],true); - + std::cerr << " Forking off the sub process. Pipes[0]: " << Pipes[0] << std::endl; // Fork off the process Process = ExecFork(); if (Process == 0) @@ -138,6 +143,7 @@ bool pkgAcquire::Worker::Start() const char *Args[2]; Args[0] = Method.c_str(); Args[1] = 0; + std::cerr << Args[0] << std::endl; execv(Args[0],(char **)Args); cerr << "Failed to exec method " << Args[0] << endl; _exit(100); @@ -161,7 +167,7 @@ bool pkgAcquire::Worker::Start() RunMessages(); if (OwnerQ != 0) SendConfiguration(); - + std::cerr << "<<<----------------------------------------------------\n" << std::endl; return true; } /*}}}*/ @@ -170,8 +176,10 @@ bool pkgAcquire::Worker::Start() /* */ bool pkgAcquire::Worker::ReadMessages() { + std::cerr << "pkgAcquire::Worker::ReadMessages() <- [Worker::MessageQueue]" << std::endl; if (::ReadMessages(InFd,MessageQueue) == false) return MethodFailure(); + //std::cerr << " MessageQueue {" << MessageQueue[0] << "}" << std::endl; return true; } /*}}}*/ @@ -181,6 +189,7 @@ bool pkgAcquire::Worker::ReadMessages() the parsers in order. */ bool pkgAcquire::Worker::RunMessages() { + std::cerr << "pkgAcquire::Worker::RunMessages() of [Worker::MessageQueue]" << std::endl; while (MessageQueue.empty() == false) { string Message = MessageQueue.front(); @@ -212,28 +221,33 @@ bool pkgAcquire::Worker::RunMessages() } // Determine the message number and dispatch + std::cerr << " Message Number: " << Number << std::endl; switch (Number) { // 100 Capabilities case 100: + std::cerr <<" 100 Capabilities" << std::endl; if (Capabilities(Message) == false) return _error->Error("Unable to process Capabilities message from %s",Access.c_str()); break; // 101 Log case 101: + std::cerr <<" 101 Log" << std::endl; if (Debug == true) clog << " <- (log) " << LookupTag(Message,"Message") << endl; break; // 102 Status case 102: + std::cerr <<" 102 Status" << std::endl; Status = LookupTag(Message,"Message"); break; // 103 Redirect case 103: { + std::cerr <<" 103 Redirect" << std::endl; if (Itm == 0) { _error->Error("Method gave invalid 103 Redirect message"); @@ -248,6 +262,7 @@ bool pkgAcquire::Worker::RunMessages() // 200 URI Start case 200: { + std::cerr <<" 201 URI Start" << std::endl; if (Itm == 0) { _error->Error("Method gave invalid 200 URI Start message"); @@ -273,6 +288,7 @@ bool pkgAcquire::Worker::RunMessages() // 201 URI Done case 201: { + std::cerr <<" 201 URI Done" << std::endl; if (Itm == 0) { _error->Error("Method gave invalid 201 URI Done message"); @@ -332,6 +348,7 @@ bool pkgAcquire::Worker::RunMessages() // 400 URI Failure case 400: { + std::cerr <<" 400 URI Failure" << std::endl; if (Itm == 0) { _error->Error("Method gave invalid 400 URI Failure message"); @@ -364,11 +381,13 @@ bool pkgAcquire::Worker::RunMessages() // 401 General Failure case 401: + std::cerr <<" 401 General Failure" << std::endl; _error->Error("Method %s General failure: %s",Access.c_str(),LookupTag(Message,"Message").c_str()); break; // 403 Media Change case 403: + std::cerr <<" 403 Media Change" << std::endl; MediaChange(Message); break; } @@ -392,7 +411,7 @@ bool pkgAcquire::Worker::Capabilities(string Message) Config->LocalOnly = StringToBool(LookupTag(Message,"Local-Only"),false); Config->NeedsCleanup = StringToBool(LookupTag(Message,"Needs-Cleanup"),false); Config->Removable = StringToBool(LookupTag(Message,"Removable"),false); - + //std::cerr << "----Capabilities()" << std::endl; // Some debug text if (Debug == true) { @@ -405,7 +424,7 @@ bool pkgAcquire::Worker::Capabilities(string Message) " NeedsCleanup: " << Config->NeedsCleanup << " Removable: " << Config->Removable << endl; } - + //std::cerr << "----Capabilities()" << std::endl; return true; } /*}}}*/ @@ -458,6 +477,8 @@ bool pkgAcquire::Worker::MediaChange(string Message) /* */ bool pkgAcquire::Worker::SendConfiguration() { + std::cerr << "pkgAcquire::Worker::SendConfiguration() -> [Worker::OutQueue]" << std::endl; + std::cerr << " Sending 601 Configuration message to the method." << std::endl; if (Config->SendConfig == false) return true; @@ -496,7 +517,7 @@ bool pkgAcquire::Worker::SendConfiguration() clog << " -> " << Access << ':' << QuoteString(Message,"\n") << endl; OutQueue += Message; OutReady = true; - + //std::cerr << " OutQueue {" << Message.length() <<"}"<< std::endl; return true; } /*}}}*/ @@ -519,7 +540,7 @@ bool pkgAcquire::Worker::QueueItem(pkgAcquire::Queue::QItem *Item) clog << " -> " << Access << ':' << QuoteString(Message,"\n") << endl; OutQueue += Message; OutReady = true; - + return true; } /*}}}*/ @@ -528,10 +549,12 @@ bool pkgAcquire::Worker::QueueItem(pkgAcquire::Queue::QItem *Item) /* */ bool pkgAcquire::Worker::OutFdReady() { + //std::cerr << "pkgAcquire::Worker::OutFdReady()." << std::endl; int Res; do { Res = write(OutFd,OutQueue.c_str(),OutQueue.length()); + //std::cerr << " writing the OutQueue to the OutFd " << OutFd << std::endl; } while (Res < 0 && errno == EINTR); |