Permalink
Browse files

Completly fix ISSUE9

  • Loading branch information...
1 parent f71a8d3 commit 156cfa9815fbf978e73cbd58d532371909e22b5e @binf binf committed Dec 11, 2011
Showing with 18 additions and 2 deletions.
  1. +18 −2 src/spooler.c
View
@@ -381,6 +381,9 @@ int ProcessContinuous(const char *dirpath, const char *filebase,
uint32_t skipped = 0;
uint32_t extension = 0;
+ u_int32_t waldo_timestamp = 0;
+ waldo_timestamp = timestamp; /* fix possible bug by keeping invocated timestamp at the time of the initial call */
+
if (BcProcessNewRecordsOnly())
{
LogMessage("Processing new records only.\n");
@@ -407,6 +410,15 @@ int ProcessContinuous(const char *dirpath, const char *filebase,
/* find the next file to spool */
ret = FindNextExtension(dirpath, filebase, timestamp, &extension);
+ /* The file found is not the same as specified in the waldo,
+ thus we need to reset record_start, since we are obviously not processing the same file*/
+ if(waldo_timestamp != extension)
+ {
+ record_start = 0; /* There is no danger to resetting record_start to 0
+ if called timestamp is not the same */
+ }
+
+
/* no new extensions found */
if (ret == SPOOLER_EXTENSION_NONE)
{
@@ -431,7 +443,7 @@ int ProcessContinuous(const char *dirpath, const char *filebase,
pc_ret = -1;
continue;
}
-
+
/* found a new extension so create a new spooler */
if ( (spooler=spoolerOpen(dirpath, filebase, extension)) == NULL )
{
@@ -440,7 +452,11 @@ int ProcessContinuous(const char *dirpath, const char *filebase,
pc_ret = -1;
continue;
}
-
+
+ /* Make sure we create a new waldo even if we did not have processed an event */
+ spooler->record_idx = 0;
+ spoolerWriteWaldo(&barnyard2_conf->waldo, spooler);
+
waiting_logged = 0;
/* set timestamp to ensure we look for a newer file next time */

0 comments on commit 156cfa9

Please sign in to comment.