mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
Base: Clean up explicit uses of namespaces in places where they're not necessary.
This commit covers all of the common and base classes.
This commit is contained in:
parent
9f802b2a4d
commit
fe0c22c789
240 changed files with 6823 additions and 6787 deletions
|
@ -25,7 +25,7 @@ void HeartbeatTimer::Dispatch(double t, bool is_expire)
|
|||
|
||||
Manager::Manager()
|
||||
{
|
||||
DBG_LOG(zeek::DBG_THREADING, "Creating thread manager ...");
|
||||
DBG_LOG(DBG_THREADING, "Creating thread manager ...");
|
||||
|
||||
did_process = true;
|
||||
next_beat = 0;
|
||||
|
@ -40,7 +40,7 @@ Manager::~Manager()
|
|||
|
||||
void Manager::Terminate()
|
||||
{
|
||||
DBG_LOG(zeek::DBG_THREADING, "Terminating thread manager ...");
|
||||
DBG_LOG(DBG_THREADING, "Terminating thread manager ...");
|
||||
terminating = true;
|
||||
|
||||
// First process remaining thread output for the message threads.
|
||||
|
@ -68,7 +68,7 @@ void Manager::Terminate()
|
|||
|
||||
void Manager::AddThread(BasicThread* thread)
|
||||
{
|
||||
DBG_LOG(zeek::DBG_THREADING, "Adding thread %s ...", thread->Name());
|
||||
DBG_LOG(DBG_THREADING, "Adding thread %s ...", thread->Name());
|
||||
all_threads.push_back(thread);
|
||||
|
||||
if ( ! heartbeat_timer_running )
|
||||
|
@ -77,13 +77,13 @@ void Manager::AddThread(BasicThread* thread)
|
|||
|
||||
void Manager::AddMsgThread(MsgThread* thread)
|
||||
{
|
||||
DBG_LOG(zeek::DBG_THREADING, "%s is a MsgThread ...", thread->Name());
|
||||
DBG_LOG(DBG_THREADING, "%s is a MsgThread ...", thread->Name());
|
||||
msg_threads.push_back(thread);
|
||||
}
|
||||
|
||||
void Manager::KillThreads()
|
||||
{
|
||||
DBG_LOG(zeek::DBG_THREADING, "Killing threads ...");
|
||||
DBG_LOG(DBG_THREADING, "Killing threads ...");
|
||||
|
||||
for ( all_thread_list::iterator i = all_threads.begin(); i != all_threads.end(); i++ )
|
||||
(*i)->Kill();
|
||||
|
@ -91,7 +91,7 @@ void Manager::KillThreads()
|
|||
|
||||
void Manager::KillThread(BasicThread* thread)
|
||||
{
|
||||
DBG_LOG(zeek::DBG_THREADING, "Killing thread %s ...", thread->Name());
|
||||
DBG_LOG(DBG_THREADING, "Killing thread %s ...", thread->Name());
|
||||
thread->Kill();
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ void Manager::SendHeartbeats()
|
|||
void Manager::StartHeartbeatTimer()
|
||||
{
|
||||
heartbeat_timer_running = true;
|
||||
zeek::detail::timer_mgr->Add(new detail::HeartbeatTimer(zeek::run_state::network_time + zeek::BifConst::Threading::heartbeat_interval));
|
||||
zeek::detail::timer_mgr->Add(new detail::HeartbeatTimer(run_state::network_time + BifConst::Threading::heartbeat_interval));
|
||||
}
|
||||
|
||||
// Raise everything in here as warnings so it is passed to scriptland without
|
||||
|
@ -139,16 +139,16 @@ void Manager::StartHeartbeatTimer()
|
|||
// one reporter message.
|
||||
bool Manager::SendEvent(MsgThread* thread, const std::string& name, const int num_vals, Value* *vals) const
|
||||
{
|
||||
zeek::EventHandler* handler = zeek::event_registry->Lookup(name);
|
||||
EventHandler* handler = event_registry->Lookup(name);
|
||||
if ( handler == nullptr )
|
||||
{
|
||||
zeek::reporter->Warning("Thread %s: Event %s not found", thread->Name(), name.c_str());
|
||||
reporter->Warning("Thread %s: Event %s not found", thread->Name(), name.c_str());
|
||||
Value::delete_value_ptr_array(vals, num_vals);
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
DBG_LOG(zeek::DBG_INPUT, "Thread %s: SendEvent for event %s with %d vals",
|
||||
DBG_LOG(DBG_INPUT, "Thread %s: SendEvent for event %s with %d vals",
|
||||
thread->Name(), name.c_str(), num_vals);
|
||||
#endif
|
||||
|
||||
|
@ -156,20 +156,20 @@ bool Manager::SendEvent(MsgThread* thread, const std::string& name, const int nu
|
|||
int num_event_vals = type->NumFields();
|
||||
if ( num_vals != num_event_vals )
|
||||
{
|
||||
zeek::reporter->Warning("Thread %s: Wrong number of values for event %s", thread->Name(), name.c_str());
|
||||
reporter->Warning("Thread %s: Wrong number of values for event %s", thread->Name(), name.c_str());
|
||||
Value::delete_value_ptr_array(vals, num_vals);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool convert_error = false;
|
||||
|
||||
zeek::Args vl;
|
||||
Args vl;
|
||||
vl.reserve(num_vals);
|
||||
|
||||
for ( int j = 0; j < num_vals; j++)
|
||||
{
|
||||
zeek::Val* v = Value::ValueToVal(std::string("thread ") + thread->Name(), vals[j], convert_error);
|
||||
vl.emplace_back(zeek::AdoptRef{}, v);
|
||||
Val* v = Value::ValueToVal(std::string("thread ") + thread->Name(), vals[j], convert_error);
|
||||
vl.emplace_back(AdoptRef{}, v);
|
||||
|
||||
if ( v && ! convert_error && ! same_type(type->GetFieldType(j), v->GetType()) )
|
||||
{
|
||||
|
@ -183,7 +183,7 @@ bool Manager::SendEvent(MsgThread* thread, const std::string& name, const int nu
|
|||
if ( convert_error )
|
||||
return false;
|
||||
else if ( handler )
|
||||
zeek::event_mgr.Enqueue(handler, std::move(vl), zeek::util::detail::SOURCE_LOCAL);
|
||||
event_mgr.Enqueue(handler, std::move(vl), util::detail::SOURCE_LOCAL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -192,10 +192,10 @@ void Manager::Flush()
|
|||
{
|
||||
bool do_beat = false;
|
||||
|
||||
if ( zeek::run_state::network_time && (zeek::run_state::network_time > next_beat || ! next_beat) )
|
||||
if ( run_state::network_time && (run_state::network_time > next_beat || ! next_beat) )
|
||||
{
|
||||
do_beat = true;
|
||||
next_beat = ::zeek::run_state::network_time + zeek::BifConst::Threading::heartbeat_interval;
|
||||
next_beat = run_state::network_time + BifConst::Threading::heartbeat_interval;
|
||||
}
|
||||
|
||||
did_process = false;
|
||||
|
@ -214,13 +214,13 @@ void Manager::Flush()
|
|||
|
||||
if ( msg->Process() )
|
||||
{
|
||||
if ( zeek::run_state::network_time )
|
||||
if ( run_state::network_time )
|
||||
did_process = true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
zeek::reporter->Error("%s failed, terminating thread", msg->Name());
|
||||
reporter->Error("%s failed, terminating thread", msg->Name());
|
||||
t->SignalStop();
|
||||
}
|
||||
|
||||
|
@ -254,8 +254,8 @@ void Manager::Flush()
|
|||
delete t;
|
||||
}
|
||||
|
||||
// fprintf(stderr, "P %.6f %.6f do_beat=%d did_process=%d next_next=%.6f\n", zeek::run_state::network_time,
|
||||
// zeek::detail::timer_mgr->Time(), do_beat, (int)did_process, next_beat);
|
||||
// fprintf(stderr, "P %.6f %.6f do_beat=%d did_process=%d next_next=%.6f\n", run_state::network_time,
|
||||
// detail::timer_mgr->Time(), do_beat, (int)did_process, next_beat);
|
||||
}
|
||||
|
||||
const threading::Manager::msg_stats_list& threading::Manager::GetMsgThreadStats()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue