From b5fe97a45885843a9b62b75530256c45e2259671 Mon Sep 17 00:00:00 2001 From: Leonid Gershanovich Date: Fri, 1 Feb 2019 14:32:12 +0000 Subject: [PATCH] issue_42_56: use actual number of received messages, not the expected number --- src/samplers/statsd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/samplers/statsd.c b/src/samplers/statsd.c index a479f1d..5d14dff 100644 --- a/src/samplers/statsd.c +++ b/src/samplers/statsd.c @@ -51,9 +51,9 @@ static void statsd_run_recvmmsg(struct brubeck_statsd *statsd, int sock) } /* store stats */ - brubeck_atomic_add(&statsd->sampler.inflow, SIM_PACKETS); + brubeck_atomic_add(&statsd->sampler.inflow, res); - for (i = 0; i < SIM_PACKETS; ++i) { + for (i = 0; i < res; ++i) { char *buf = msgs[i].msg_hdr.msg_iov->iov_base; char *end = buf + msgs[i].msg_len; brubeck_statsd_packet_parse(server, buf, end);