FileAnalysis: add bif for setting timeout interval

This commit is contained in:
Jon Siwek 2013-04-11 12:08:46 -05:00
parent e2fbee9054
commit 2fba37e277
7 changed files with 55 additions and 2 deletions

View file

@ -189,6 +189,11 @@ double File::GetTimeoutInterval() const
return LookupFieldDefaultInterval(timeout_interval_idx);
}
void File::SetTimeoutInterval(double interval)
{
val->Assign(timeout_interval_idx, new Val(interval, TYPE_INTERVAL));
}
void File::IncrementByteCount(uint64 size, int field_idx)
{
uint64 old = LookupFieldDefaultCount(field_idx);

View file

@ -34,6 +34,11 @@ public:
*/
double GetTimeoutInterval() const;
/**
* Set the "timeout_interval" field from #val record to \a interval seconds.
*/
void SetTimeoutInterval(double interval);
/**
* @return value of the "id" field from #val record.
*/

View file

@ -157,6 +157,16 @@ bool Manager::PostponeTimeout(const FileID& file_id) const
return true;
}
bool Manager::SetTimeoutInterval(const FileID& file_id, double interval) const
{
File* file = Lookup(file_id);
if ( ! file ) return false;
file->SetTimeoutInterval(interval);
return true;
}
bool Manager::AddAction(const FileID& file_id, RecordVal* args) const
{
File* file = Lookup(file_id);

View file

@ -96,6 +96,11 @@ public:
*/
bool PostponeTimeout(const FileID& file_id) const;
/**
* Set's an inactivity threshold for the file.
*/
bool SetTimeoutInterval(const FileID& file_id, double interval) const;
/**
* Queue attachment of an action to the file identifier. Multiple actions
* of a given type can be attached per file identifier at a time as long as