From: Alan T. DeKok Date: Mon, 30 Oct 2017 19:12:11 +0000 (-0400) Subject: merge thread stats into global stats on thread exit X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43abe760619dfe2c14ae373fe8922b6287469b32;p=thirdparty%2Ffreeradius-server.git merge thread stats into global stats on thread exit --- diff --git a/src/modules/rlm_stats/rlm_stats.c b/src/modules/rlm_stats/rlm_stats.c index d4d66b082f5..d427371645b 100644 --- a/src/modules/rlm_stats/rlm_stats.c +++ b/src/modules/rlm_stats/rlm_stats.c @@ -176,10 +176,12 @@ static int mod_thread_detach(void *thread) { rlm_stats_thread_t *t = talloc_get_type_abort(thread, rlm_stats_thread_t); rlm_stats_t *inst = t->inst; - + int i; PTHREAD_MUTEX_LOCK(&inst->mutex); - // @todo - merge all of the stats in + for (i = 0; i < FR_MAX_PACKET_CODE; i++) { + inst->stats[i] += t->stats[i]; + } PTHREAD_MUTEX_UNLOCK(&inst->mutex); return 0;