PktSrc: Move termination pseduo_realtime special case to RunState

This also removes setting pseduo_realtime to 0.0 in the main loop
when the packet source has been closed. I had tried to understand
the implications it actually seems, if we shutdown the iosource::Manager
anyway, it shouldn't and it's just confusing.
This commit is contained in:
Arne Welzel 2023-03-14 17:53:43 +01:00
parent a9cec2e4f4
commit a9f8627dd9
2 changed files with 4 additions and 14 deletions

View file

@ -352,17 +352,13 @@ void run_loop()
// the future on which we need to wait. // the future on which we need to wait.
have_pending_timers = zeek::detail::timer_mgr->Size() > 0; have_pending_timers = zeek::detail::timer_mgr->Size() > 0;
// Terminate if we're running pseudo_realtime and
// the interface has been closed.
if ( pseudo_realtime && communication_enabled ) if ( pseudo_realtime && communication_enabled )
{ {
auto have_active_packet_source = false;
iosource::PktSrc* ps = iosource_mgr->GetPktSrc(); iosource::PktSrc* ps = iosource_mgr->GetPktSrc();
if ( ps && ps->IsOpen() ) if ( ps && ! ps->IsOpen() )
have_active_packet_source = true; iosource_mgr->Terminate();
if ( ! have_active_packet_source )
// Can turn off pseudo realtime now
pseudo_realtime = 0.0;
} }
} }

View file

@ -194,12 +194,6 @@ bool PktSrc::ExtractNextPacketInternal()
had_packet = false; had_packet = false;
} }
if ( run_state::pseudo_realtime && ! IsOpen() )
{
if ( broker_mgr->Active() )
iosource_mgr->Terminate();
}
return false; return false;
} }