diff options
author | Yunchih Chen <yunchih.cat@gmail.com> | 2018-03-17 11:47:16 +0800 |
---|---|---|
committer | Yunchih Chen <yunchih.cat@gmail.com> | 2018-03-17 11:48:45 +0800 |
commit | 0b41d9d0b4cbc761ffbcd2a8f56b1749b1f42ed4 (patch) | |
tree | eac7f5f97626b080668c68db688332fac4bf376f /lib/collect.c | |
parent | 79b15e9010c247c571ea012f5363d098d711496b (diff) | |
download | nfcollect-0b41d9d0b4cbc761ffbcd2a8f56b1749b1f42ed4.tar nfcollect-0b41d9d0b4cbc761ffbcd2a8f56b1749b1f42ed4.tar.gz nfcollect-0b41d9d0b4cbc761ffbcd2a8f56b1749b1f42ed4.tar.bz2 nfcollect-0b41d9d0b4cbc761ffbcd2a8f56b1749b1f42ed4.tar.lz nfcollect-0b41d9d0b4cbc761ffbcd2a8f56b1749b1f42ed4.tar.xz nfcollect-0b41d9d0b4cbc761ffbcd2a8f56b1749b1f42ed4.tar.zst nfcollect-0b41d9d0b4cbc761ffbcd2a8f56b1749b1f42ed4.zip |
Fix committer bug
Diffstat (limited to 'lib/collect.c')
-rw-r--r-- | lib/collect.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/collect.c b/lib/collect.c index 0cba852..b7cf430 100644 --- a/lib/collect.c +++ b/lib/collect.c @@ -182,7 +182,7 @@ static void *nfl_start_commit_worker(void *targs) { sem_wait(g.nfl_commit_queue); debug("Comm worker #%u: commit started.", nf->header->id); - nfl_commit_worker(nf->header, nf->store, filename); + nfl_commit_worker(nf->header, nf->store, g.compression_opt, filename); debug("Comm worker #%u: commit done.", nf->header->id); sem_post(g.nfl_commit_queue); @@ -209,8 +209,9 @@ void nfl_state_init(nflog_state_t **nf, uint32_t id, uint32_t entries_max, (*nf)->global = g; (*nf)->header = (nflog_header_t *)malloc(sizeof(nflog_header_t)); (*nf)->header->id = id; - (*nf)->header->max_n_entries = entries_max; (*nf)->header->n_entries = 0; + (*nf)->header->max_n_entries = entries_max; + (*nf)->header->compression_opt = g->compression_opt; (*nf)->has_finished = true; pthread_mutex_init(&(*nf)->has_finished_lock, NULL); @@ -218,10 +219,8 @@ void nfl_state_init(nflog_state_t **nf, uint32_t id, uint32_t entries_max, } // Ensure trunk with same id in previous run has finished to prevent reusing - // a trunk - // which it's still being used. Furthermore, this hopefully alleviate us - // from - // bursty network traffic. + // a trunk which it's still being used. Furthermore, this hopefully alleviate us + // from bursty network traffic. pthread_mutex_lock(&(*nf)->has_finished_lock); while (!(*nf)->has_finished) pthread_cond_wait(&(*nf)->has_finished_cond, &(*nf)->has_finished_lock); @@ -236,6 +235,6 @@ void nfl_state_init(nflog_state_t **nf, uint32_t id, uint32_t entries_max, } static void nfl_state_free(nflog_state_t *nf) { - // Free only and leave the rest intact + // Free only packet store and leave the rest intact free((void *)nf->store); } |