files: simplify pruning logic

Since ebcc4db84a the flow worker runs
file pruning after parsing, detection and loging. This means we can
simplify the pruning logic. If a file is in state >= CLOSED, we can
prune it. Detection and outputs will have had a final chance to
process it.

Remove the calls to the pruning code from Rust. They are no longer
needed.
pull/4393/head
Victor Julien 6 years ago
parent ab471c3054
commit f9155aa121

@ -110,7 +110,6 @@ impl FileTransferTracker {
}
self.file_open = false;
self.tracked = 0;
files.files_prune();
}
pub fn trunc (&mut self, files: &mut FileContainer, flags: u16) {
@ -120,7 +119,6 @@ impl FileTransferTracker {
let myflags = flags | 1; // TODO util-file.c::FILE_TRUNCATED
files.file_close(&self.track_id, myflags);
SCLogDebug!("truncated file");
files.files_prune();
self.file_is_truncated = true;
}
@ -322,7 +320,6 @@ impl FileTransferTracker {
consumed += data.len();
}
}
files.files_prune();
consumed as u32
}

@ -332,10 +332,7 @@ static int FilePruneFile(File *file)
SCLogDebug("file->state %d. Is >= FILE_STATE_CLOSED: %s", file->state, (file->state >= FILE_STATE_CLOSED) ? "yes" : "no");
/* file is done when state is closed+, logging/storing is done (if any) */
if (file->state >= FILE_STATE_CLOSED &&
(!RunModeOutputFileEnabled() || (file->flags & FILE_LOGGED)) &&
(!RunModeOutputFiledataEnabled() || (file->flags & (FILE_STORED|FILE_NOSTORE))))
{
if (file->state >= FILE_STATE_CLOSED) {
SCReturnInt(1);
} else {
SCReturnInt(0);

Loading…
Cancel
Save