Skip to content

Commit

Permalink
Allow counter-samples to update agent->now in case there are
Browse files Browse the repository at this point in the history
no packet samples to do it.
  • Loading branch information
sflow committed Feb 2, 2018
1 parent 0342b38 commit 5ba9fb6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Linux/hsflowd.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ extern "C" {
static void evt_poll_tick(EVMod *mod, EVEvent *evt, void *data, size_t dataLen) {
HSP *sp = (HSP *)EVROOTDATA(mod);
time_t clk = evt->bus->now.tv_sec;
time_t clk_nS = evt->bus->now.tv_nsec;

// reset the pollActions
UTArrayReset(sp->pollActions);
Expand All @@ -497,6 +498,8 @@ extern "C" {
// sync_receiver lock, which is needed when the final
// counter sample is submitted for XDR serialization.
SEMLOCK_DO(sp->sync_agent) {
// update agent 'now' (also updated by packet samples):
sfl_agent_set_now(sp->agent, clk, evt->bus->now.tv_nsec);
// only run the poller_tick()s here, not the full agent_tick()
// we'll call receiver_flush at the end of this tick/tock cycle,
// and skip the sampler_tick() altogether.
Expand Down
2 changes: 1 addition & 1 deletion src/Linux/readPackets.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ extern "C" {
{
if(--ps->refCount == 0) {
EVBus *bus = EVCurrentBus();
sfl_agent_set_now(ps->sampler->agent, bus->now.tv_sec, bus->now.tv_nsec);
SEMLOCK_DO(sp->sync_agent) {
sfl_agent_set_now(ps->sampler->agent, bus->now.tv_sec, bus->now.tv_nsec);
sfl_sampler_writeFlowSample(ps->sampler, ps->fs);
sp->telemetry[HSP_TELEMETRY_FLOW_SAMPLES]++;
}
Expand Down

0 comments on commit 5ba9fb6

Please sign in to comment.