mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Reformat Zeek in Spicy style
This largely copies over Spicy's `.clang-format` configuration file. The one place where we deviate is header include order since Zeek depends on headers being included in a certain order.
This commit is contained in:
parent
7b8e7ed72c
commit
f5a76c1aed
786 changed files with 131714 additions and 153609 deletions
|
@ -5,42 +5,38 @@
|
|||
#include "zeek/file_analysis/File.h"
|
||||
#include "zeek/file_analysis/Manager.h"
|
||||
|
||||
namespace zeek::file_analysis::detail
|
||||
{
|
||||
namespace zeek::file_analysis::detail {
|
||||
|
||||
FileTimer::FileTimer(double t, const std::string& id, double interval)
|
||||
: zeek::detail::Timer(t + interval, zeek::detail::TIMER_FILE_ANALYSIS_INACTIVITY), file_id(id)
|
||||
{
|
||||
DBG_LOG(DBG_FILE_ANALYSIS, "New %f second timeout timer for %s", interval, file_id.c_str());
|
||||
}
|
||||
: zeek::detail::Timer(t + interval, zeek::detail::TIMER_FILE_ANALYSIS_INACTIVITY), file_id(id) {
|
||||
DBG_LOG(DBG_FILE_ANALYSIS, "New %f second timeout timer for %s", interval, file_id.c_str());
|
||||
}
|
||||
|
||||
void FileTimer::Dispatch(double t, bool is_expire)
|
||||
{
|
||||
File* file = file_mgr->LookupFile(file_id);
|
||||
void FileTimer::Dispatch(double t, bool is_expire) {
|
||||
File* file = file_mgr->LookupFile(file_id);
|
||||
|
||||
if ( ! file )
|
||||
return;
|
||||
if ( ! file )
|
||||
return;
|
||||
|
||||
double last_active = file->GetLastActivityTime();
|
||||
double inactive_time = t > last_active ? t - last_active : 0.0;
|
||||
double last_active = file->GetLastActivityTime();
|
||||
double inactive_time = t > last_active ? t - last_active : 0.0;
|
||||
|
||||
DBG_LOG(DBG_FILE_ANALYSIS,
|
||||
"Checking inactivity for %s, last active at %f, "
|
||||
"inactive for %f",
|
||||
file_id.c_str(), last_active, inactive_time);
|
||||
DBG_LOG(DBG_FILE_ANALYSIS,
|
||||
"Checking inactivity for %s, last active at %f, "
|
||||
"inactive for %f",
|
||||
file_id.c_str(), last_active, inactive_time);
|
||||
|
||||
if ( last_active == 0.0 )
|
||||
{
|
||||
// was created when network_time was zero, so re-schedule w/ valid time
|
||||
file->UpdateLastActivityTime();
|
||||
file->ScheduleInactivityTimer();
|
||||
return;
|
||||
}
|
||||
if ( last_active == 0.0 ) {
|
||||
// was created when network_time was zero, so re-schedule w/ valid time
|
||||
file->UpdateLastActivityTime();
|
||||
file->ScheduleInactivityTimer();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( inactive_time >= file->GetTimeoutInterval() )
|
||||
file_mgr->Timeout(file_id);
|
||||
else if ( ! is_expire )
|
||||
file->ScheduleInactivityTimer();
|
||||
}
|
||||
if ( inactive_time >= file->GetTimeoutInterval() )
|
||||
file_mgr->Timeout(file_id);
|
||||
else if ( ! is_expire )
|
||||
file->ScheduleInactivityTimer();
|
||||
}
|
||||
|
||||
} // namespace zeek::file_analysis::detail
|
||||
} // namespace zeek::file_analysis::detail
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue