mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
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:
parent
a9cec2e4f4
commit
a9f8627dd9
2 changed files with 4 additions and 14 deletions
|
@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue