Logo Search packages:      
Sourcecode: pan version File versions

void TaskGroups::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.

Parameters:
health if OK, the command was successful. if RETRY, the command couldn't be processed now but might be successful later -- perhaps there was a bad connection. if FAIL, there's no point in retrying -- perhaps the article has expired.

Reimplemented from pan::NNTP::Listener.

Definition at line 129 of file task-groups.cc.

References pan::NNTP::_server, pan::Data::add_groups(), pan::OK, pan::RETRY, pan::Task::State::set_completed(), and pan::Task::State::set_need_nntp().

{
  debug ("groups task got an on_nntp_done() from " << nntp->_server);

  const bool is_ok (health == OK);

  if (health == RETRY)
  {
    _state.set_need_nntp (_servername);
  }
  else // heath is OK or FAIL
  {
    if (_step == LIST_NEWSGROUPS)
    {
      int i (0);
      Data::NewGroup * ng = new Data::NewGroup [_new_groups.size()];
      foreach_const (new_groups_t, _new_groups, it)
        ng[i++] = it->second;
      _data.add_groups (_servername, ng, i);
      delete [] ng;

      debug ("groups task setting state completed");
      _state.set_completed ();
      set_finished (OK);
    }
    else // _step == LIST
    {
      _state.set_need_nntp (_servername);
      _step = LIST_NEWSGROUPS;
    }
  }

  check_in (nntp, is_ok);
}


Generated by  Doxygen 1.6.0   Back to index