iosource: Make poll intervals configurable

This probably should not be changed by users, but it's useful for
testing and experimentation rather than needing to recompile.

Processing 100 packets without checking an FD based IO source can
actually mean that FD based sources are never checked during a read
of a very small pcap...
This commit is contained in:
Arne Welzel 2023-03-17 21:20:52 +01:00
parent 5f1a85803a
commit 46c432dc8b
4 changed files with 35 additions and 6 deletions

View file

@ -105,6 +105,7 @@ Manager::~Manager()
void Manager::InitPostScript()
{
wakeup = new WakeupHandler();
poll_interval = BifConst::io_poll_interval_default;
}
void Manager::RemoveAll()
@ -401,12 +402,8 @@ void Manager::Register(PktSrc* src)
{
pkt_src = src;
// The poll interval gets defaulted to 100 which is good for cases like reading
// from pcap files and when there isn't a packet source, but is a little too
// infrequent for live sources (especially fast live sources). Set it down a
// little bit for those sources.
if ( src->IsLive() )
poll_interval = 10;
poll_interval = BifConst::io_poll_interval_live;
else if ( run_state::pseudo_realtime )
poll_interval = 1;