diff --git a/scripts/base/frameworks/file-analysis/main.bro b/scripts/base/frameworks/file-analysis/main.bro index 3f6f6f10f4..0502daa186 100644 --- a/scripts/base/frameworks/file-analysis/main.bro +++ b/scripts/base/frameworks/file-analysis/main.bro @@ -120,7 +120,9 @@ export { ## Sets the *timeout_interval* field of :bro:see:`fa_file`, which is ## used to determine the length of inactivity that is allowed for a file - ## before internal state related to it is cleaned up. + ## before internal state related to it is cleaned up. When used within a + ## :bro:see:`file_timeout` handler, the analysis will delay timing out + ## again for the period specified by *t*. ## ## f: the file. ## @@ -130,18 +132,6 @@ export { ## for the *id* isn't currently active. global set_timeout_interval: function(f: fa_file, t: interval): bool; - ## Postpones the timeout of file analysis for a given file. - ## When used within a :bro:see:`file_timeout` handler for, the analysis - ## the analysis will delay timing out for the period of time indicated by - ## the *timeout_interval* field of :bro:see:`fa_file`, which can be set - ## with :bro:see:`FileAnalysis::set_timeout_interval`. - ## - ## f: the file. - ## - ## Returns: true if the timeout will be postponed, or false if analysis - ## for the *id* isn't currently active. - global postpone_timeout: function(f: fa_file): bool; - ## Adds an analyzer to the analysis of a given file. ## ## f: the file. @@ -207,11 +197,6 @@ function set_timeout_interval(f: fa_file, t: interval): bool return __set_timeout_interval(f$id, t); } -function postpone_timeout(f: fa_file): bool - { - return __postpone_timeout(f$id); - } - function add_analyzer(f: fa_file, args: AnalyzerArgs): bool { if ( ! __add_analyzer(f$id, args) ) return F; diff --git a/src/file_analysis.bif b/src/file_analysis.bif index 3c720d17b6..ef46ccf9c1 100644 --- a/src/file_analysis.bif +++ b/src/file_analysis.bif @@ -27,13 +27,6 @@ enum Analyzer %{ ANALYZER_DATA_EVENT, %} -## :bro:see:`FileAnalysis::postpone_timeout`. -function FileAnalysis::__postpone_timeout%(file_id: string%): bool - %{ - bool result = file_mgr->PostponeTimeout(file_id->CheckString()); - return new Val(result, TYPE_BOOL); - %} - ## :bro:see:`FileAnalysis::set_timeout_interval`. function FileAnalysis::__set_timeout_interval%(file_id: string, t: interval%): bool %{ diff --git a/src/file_analysis/Manager.cc b/src/file_analysis/Manager.cc index 584a599df0..b247f23efc 100644 --- a/src/file_analysis/Manager.cc +++ b/src/file_analysis/Manager.cc @@ -153,17 +153,6 @@ void Manager::SetSize(uint64 size, AnalyzerTag::Tag tag, Connection* conn, RemoveFile(file->GetID()); } -bool Manager::PostponeTimeout(const string& file_id) const - { - File* file = Lookup(file_id); - - if ( ! file ) - return false; - - file->postpone_timeout = true; - return true; - } - bool Manager::SetTimeoutInterval(const string& file_id, double interval) const { File* file = Lookup(file_id); @@ -171,6 +160,9 @@ bool Manager::SetTimeoutInterval(const string& file_id, double interval) const if ( ! file ) return false; + if ( interval > 0 ) + file->postpone_timeout = true; + file->SetTimeoutInterval(interval); return true; } diff --git a/src/file_analysis/Manager.h b/src/file_analysis/Manager.h index 17ea2ef317..8e985d6ce3 100644 --- a/src/file_analysis/Manager.h +++ b/src/file_analysis/Manager.h @@ -88,12 +88,6 @@ public: */ bool IgnoreFile(const string& file_id); - /** - * If called during a \c file_timeout event handler, requests deferral of - * analysis timeout. - */ - bool PostponeTimeout(const string& file_id) const; - /** * Set's an inactivity threshold for the file. */ diff --git a/testing/btest/Baseline/scripts.base.frameworks.file-analysis.bifs.postpone_timeout/bro..stdout b/testing/btest/Baseline/scripts.base.frameworks.file-analysis.bifs.set_timeout_interval/bro..stdout similarity index 100% rename from testing/btest/Baseline/scripts.base.frameworks.file-analysis.bifs.postpone_timeout/bro..stdout rename to testing/btest/Baseline/scripts.base.frameworks.file-analysis.bifs.set_timeout_interval/bro..stdout diff --git a/testing/btest/scripts/base/frameworks/file-analysis/bifs/postpone_timeout.bro b/testing/btest/scripts/base/frameworks/file-analysis/bifs/set_timeout_interval.bro similarity index 90% rename from testing/btest/scripts/base/frameworks/file-analysis/bifs/postpone_timeout.bro rename to testing/btest/scripts/base/frameworks/file-analysis/bifs/set_timeout_interval.bro index eddc933658..8ec4704cdb 100644 --- a/testing/btest/scripts/base/frameworks/file-analysis/bifs/postpone_timeout.bro +++ b/testing/btest/scripts/base/frameworks/file-analysis/bifs/set_timeout_interval.bro @@ -20,7 +20,7 @@ redef default_file_timeout_interval = 2sec; event file_timeout(f: fa_file) { if ( timeout_cnt < 1 ) - FileAnalysis::postpone_timeout(f); + FileAnalysis::set_timeout_interval(f, f$timeout_interval); else terminate(); ++timeout_cnt;