Reformat the world

This commit is contained in:
Tim Wojtulewicz 2021-09-16 15:35:39 -07:00
parent 194cb24547
commit b2f171ec69
714 changed files with 35149 additions and 35203 deletions

View file

@ -1,17 +1,18 @@
// See the file "COPYING" in the main distribution directory for copyright.
#include "zeek/zeek-config.h"
#include "zeek/Timer.h"
#include "zeek/util.h"
#include "zeek/Desc.h"
#include "zeek/RunState.h"
#include "zeek/NetVar.h"
#include "zeek/RunState.h"
#include "zeek/broker/Manager.h"
#include "zeek/iosource/Manager.h"
#include "zeek/iosource/PktSrc.h"
#include "zeek/util.h"
#include "zeek/zeek-config.h"
namespace zeek::detail {
namespace zeek::detail
{
// Names of timers in same order than in TimerType.
const char* TimerNames[] = {
@ -58,7 +59,7 @@ const char* timer_type_to_string(TimerType type)
void Timer::Describe(ODesc* d) const
{
d->Add(TimerNames[type]);
d->Add(" at " );
d->Add(" at ");
d->Add(Time());
}
@ -74,9 +75,7 @@ TimerMgr::TimerMgr()
iosource_mgr->Register(this, true);
}
TimerMgr::~TimerMgr()
{
}
TimerMgr::~TimerMgr() { }
int TimerMgr::Advance(double arg_t, int max_expire)
{
@ -97,13 +96,14 @@ void TimerMgr::Process()
// pseudo-realtime), advance the timer here to the current time since otherwise it won't
// move forward and the timers won't fire correctly.
iosource::PktSrc* pkt_src = iosource_mgr->GetPktSrc();
if ( ! pkt_src || ! pkt_src->IsOpen() || run_state::reading_live || run_state::is_processing_suspended() )
if ( ! pkt_src || ! pkt_src->IsOpen() || run_state::reading_live ||
run_state::is_processing_suspended() )
run_state::detail::update_network_time(util::current_time());
// Just advance the timer manager based on the current network time. This won't actually
// change the time, but will dispatch any timers that need dispatching.
run_state::current_dispatched += Advance(
run_state::network_time, max_timer_expires - run_state::current_dispatched);
run_state::current_dispatched +=
Advance(run_state::network_time, max_timer_expires - run_state::current_dispatched);
}
void TimerMgr::InitPostScript()
@ -124,8 +124,8 @@ PQ_TimerMgr::~PQ_TimerMgr()
void PQ_TimerMgr::Add(Timer* timer)
{
DBG_LOG(DBG_TM, "Adding timer %s (%p) at %.6f",
timer_type_to_string(timer->Type()), timer, timer->Time());
DBG_LOG(DBG_TM, "Adding timer %s (%p) at %.6f", timer_type_to_string(timer->Type()), timer,
timer->Time());
// Add the timer even if it's already expired - that way, if
// multiple already-added timers are added, they'll still
@ -141,8 +141,7 @@ void PQ_TimerMgr::Expire()
Timer* timer;
while ( (timer = Remove()) )
{
DBG_LOG(DBG_TM, "Dispatching timer %s (%p)",
timer_type_to_string(timer->Type()), timer);
DBG_LOG(DBG_TM, "Dispatching timer %s (%p)", timer_type_to_string(timer->Type()), timer);
timer->Dispatch(t, true);
--current_timers[timer->Type()];
delete timer;
@ -152,8 +151,8 @@ void PQ_TimerMgr::Expire()
int PQ_TimerMgr::DoAdvance(double new_t, int max_expire)
{
Timer* timer = Top();
for ( num_expired = 0; (num_expired < max_expire ) &&
timer && timer->Time() <= new_t; ++num_expired )
for ( num_expired = 0; (num_expired < max_expire) && timer && timer->Time() <= new_t;
++num_expired )
{
last_timestamp = timer->Time();
--current_timers[timer->Type()];
@ -161,10 +160,9 @@ int PQ_TimerMgr::DoAdvance(double new_t, int max_expire)
// Remove it before dispatching, since the dispatch
// can otherwise delete it, and then we won't know
// whether we should delete it too.
(void) Remove();
(void)Remove();
DBG_LOG(DBG_TM, "Dispatching timer %s (%p)",
timer_type_to_string(timer->Type()), timer);
DBG_LOG(DBG_TM, "Dispatching timer %s (%p)", timer_type_to_string(timer->Type()), timer);
timer->Dispatch(new_t, false);
delete timer;
@ -192,4 +190,4 @@ double PQ_TimerMgr::GetNextTimeout()
return -1;
}
} // namespace zeek::detail
} // namespace zeek::detail