Fixed bugs that Daniel pointed out.
[fprobe-ulog.git] / src / fprobe-ulog.c
index 31d1e02..26eac1f 100644 (file)
@@ -378,6 +378,23 @@ inline void copy_flow(struct Flow *src, struct Flow *dst)
        dst->flags = src->flags;
 }
 
+void get_cur_epoch() {
+       int fd;
+       fd = open("/tmp/fprobe_last_epoch",O_RDONLY);
+       if (fd != -1) {
+               char snum[7];
+               ssize_t len;
+               len = read(fd, snum, sizeof(snum)-1);
+               if (len != -1) {
+                       snum[len]='\0';
+                       sscanf(snum,"%d",&cur_epoch);
+                       close(fd);
+               }
+       }
+       return;
+}
+
+
 void update_cur_epoch_file(int n) {
        int fd, len;
        char snum[7];
@@ -1447,6 +1464,8 @@ bad_collector:
                peers[npeers].write_fd = START_VALUE;
                peers[npeers].type = PEER_FILE;
                peers[npeers].seq = 0;
+
+               get_cur_epoch();
                npeers++;
        }
        else