Logo Search packages:      
Sourcecode: pan version File versions  Download package

void TaskArticle::on_nntp_done ( NNTP nntp,
Health  health,
const StringView response 
) [private, virtual]

Called at the end of an NNTP command. If the command was one that produced a list, on_nntp_line() may have been called before this.

When this is called, the listener can safely clean up anything associated with processing the command.

health returns OK, ERR_NETWORK, or ERR_SERVER. ERR_LOCAL is never used here.

Reimplemented from pan::NNTP::Listener.

Definition at line 250 of file task-article.cc.

References pan::NNTP::_server, pan::ArticleCache::add(), pan::Quark::c_str(), pan::ERR_COMMAND, pan::ERR_LOCAL, pan::ERR_NETWORK, pan::OK, and pan::Article::subject.

  // find the Needed using this nntp...
  needed_t::iterator it;
  for (it=_needed.begin(); it!=_needed.end(); ++it)
    if (it->nntp == nntp)
  assert (it != _needed.end());

  if (health == OK) { // if download succeeded, save it in the cache
    const StringView view (&it->buf.front(), it->buf.size());
    if (!_cache.add (it->message_id, view))
      health = ERR_LOCAL;

  // std::cerr << LINE_ID << ' ' << it->message_id << " from " << nntp->_server << ": health " << health << std::endl;

  switch (health)
    case OK: // if we got the article successfully...
      _needed.erase (it);

    case ERR_NETWORK: // if the network is bad...
    case ERR_LOCAL: // ...or if we got it but couldn't save it
      it->reset ();

    case ERR_COMMAND: // if this one server doesn't have this part...
      it->xref.remove_server (nntp->_server);
      if (!it->xref.empty())
        it->reset ();
      else { // if none of our servers have this part, but keep going --
             // an incomplete file gives us more PAR2 blocks than a missing one.
        Log :: add_err_va (
          _("Article \"%s\" is incomplete -- the news server(s) don't have part %s"),
        _needed.erase (it);
  update_work (nntp);
  check_in (nntp, health);

Generated by  Doxygen 1.6.0   Back to index