Logo Search packages:      
Sourcecode: pan version File versions

void TaskXOver::on_nntp_group ( NNTP nntp,
const Quark group,
unsigned long  estimated_qty,
unsigned long  low,
unsigned long  high 
) [private, virtual]

Called whenever an NNTP object sets the current group.

Reimplemented from pan::NNTP::Listener.

Definition at line 172 of file task-xover.cc.

References pan::NNTP::_server, pan::Data::get_xover_high(), and pan::Data::set_xover_low().

{
  const Quark& servername (nntp->_server);

  // new connections can tickle this...
  if (_servers_that_got_xover_minitasks.count(servername))
    return;

  _servers_that_got_xover_minitasks.insert (servername);

  debug ("got GROUP result from " << nntp->_server << " (" << nntp << "): "
         << " qty " << qty
         << " low " << low
         << " high " << high);

  unsigned long l(low), h(high);
  _data.set_xover_low (group, nntp->_server, low);
  //std::cerr << LINE_ID << " This group's range is [" << low << "..." << high << ']' << std::endl;

  if (_mode == ALL || _mode == DAYS)
    l = low;
  else if (_mode == SAMPLE) {
    _sample_size = std::min (_sample_size, high-low);
    //std::cerr << LINE_ID << " and I want to sample " <<  _sample_size << " messages..." << std::endl;
    l = std::max (low, high+1-_sample_size);
  }
  else { // NEW
    unsigned long xh (_data.get_xover_high (group, nntp->_server));
    //std::cerr << LINE_ID << " current xover high is " << xh << std::endl;
    l = std::max (xh+1, low);
  }

  if (l <= high)
  {
    //std::cerr << LINE_ID << " okay, I'll try to get articles in [" << l << "..." << h << ']' << std::endl;
    add_steps (h-l);
    const int INCREMENT (1000);
    MiniTasks_t& minitasks (_server_to_minitasks[servername]);
    for (unsigned long m=l; m<=h; m+=INCREMENT) {
      MiniTask mt (MiniTask::XOVER, m, m+INCREMENT);
      debug ("adding MiniTask for " << servername << ": xover [" << mt._low << '-' << mt._high << ']');
      minitasks.push_front (mt);
      ++_total_minitasks;
    }
  }
  else
  {
    //std::cerr << LINE_ID << " nothing new here..." << std::endl;
    _high[nntp->_server] = high;
  }
}


Generated by  Doxygen 1.6.0   Back to index