summaryrefslogtreecommitdiff
path: root/accel-pppd/radius/acct.c
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2011-09-05 15:28:02 +0400
committerKozlov Dmitry <xeb@mail.ru>2011-09-05 15:28:02 +0400
commit3e6a720a2cbd08edb6d04255b2246a833df6825c (patch)
treef273c6d460f98f83ffca94e44ac3d7b57ebb7445 /accel-pppd/radius/acct.c
parent9739251101bffde2c62ba08c1869eb170d952d5b (diff)
downloadaccel-ppp-3e6a720a2cbd08edb6d04255b2246a833df6825c.tar.gz
accel-ppp-3e6a720a2cbd08edb6d04255b2246a833df6825c.zip
radius: per-server statistics
Diffstat (limited to 'accel-pppd/radius/acct.c')
-rw-r--r--accel-pppd/radius/acct.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/accel-pppd/radius/acct.c b/accel-pppd/radius/acct.c
index bcc0a12a..6f948614 100644
--- a/accel-pppd/radius/acct.c
+++ b/accel-pppd/radius/acct.c
@@ -103,8 +103,9 @@ static int rad_acct_read(struct triton_md_handler_t *h)
dt = (req->reply->tv.tv_sec - req->pack->tv.tv_sec) * 1000 +
(req->reply->tv.tv_usec - req->pack->tv.tv_usec) / 1000;
- stat_accm_add(stat_interim_query_1m, dt);
- stat_accm_add(stat_interim_query_5m, dt);
+
+ stat_accm_add(req->serv->stat_interim_query_1m, dt);
+ stat_accm_add(req->serv->stat_interim_query_5m, dt);
if (req->reply->code != CODE_ACCOUNTING_RESPONSE || req->reply->id != req->pack->id) {
rad_packet_free(req->reply);
@@ -148,9 +149,9 @@ static void rad_acct_timeout(struct triton_timer_t *t)
struct rad_req_t *req = container_of(t, typeof(*req), timeout);
time_t ts, dt;
- __sync_add_and_fetch(&stat_interim_lost, 1);
- stat_accm_add(stat_interim_lost_1m, 1);
- stat_accm_add(stat_interim_lost_5m, 1);
+ __sync_add_and_fetch(&req->serv->stat_interim_lost, 1);
+ stat_accm_add(req->serv->stat_interim_lost_1m, 1);
+ stat_accm_add(req->serv->stat_interim_lost_5m, 1);
if (conf_acct_timeout == 0) {
rad_server_timeout(req->serv);
@@ -189,7 +190,7 @@ static void rad_acct_timeout(struct triton_timer_t *t)
__rad_req_send(req);
- __sync_add_and_fetch(&stat_interim_sent, 1);
+ __sync_add_and_fetch(&req->serv->stat_interim_sent, 1);
}
static void rad_acct_interim_update(struct triton_timer_t *t)
@@ -217,7 +218,7 @@ static void rad_acct_interim_update(struct triton_timer_t *t)
__rad_req_send(rpd->acct_req);
- __sync_add_and_fetch(&stat_interim_sent, 1);
+ __sync_add_and_fetch(&rpd->acct_req->serv->stat_interim_sent, 1);
triton_timer_add(rpd->ppp->ctrl->ctx, &rpd->acct_req->timeout, 0);
}
@@ -278,31 +279,31 @@ int rad_acct_start(struct radius_pd_t *rpd)
if (rad_req_send(rpd->acct_req, conf_verbose))
goto out_err;
- __sync_add_and_fetch(&stat_acct_sent, 1);
+ __sync_add_and_fetch(&rpd->acct_req->serv->stat_acct_sent, 1);
rad_req_wait(rpd->acct_req, conf_timeout);
if (!rpd->acct_req->reply) {
if (conf_acct_delay_time)
rpd->acct_req->pack->id++;
- __sync_add_and_fetch(&stat_acct_lost, 1);
- stat_accm_add(stat_acct_lost_1m, 1);
- stat_accm_add(stat_acct_lost_5m, 1);
+ __sync_add_and_fetch(&rpd->acct_req->serv->stat_acct_lost, 1);
+ stat_accm_add(rpd->acct_req->serv->stat_acct_lost_1m, 1);
+ stat_accm_add(rpd->acct_req->serv->stat_acct_lost_5m, 1);
continue;
}
dt = (rpd->acct_req->reply->tv.tv_sec - rpd->acct_req->pack->tv.tv_sec) * 1000 +
(rpd->acct_req->reply->tv.tv_usec - rpd->acct_req->pack->tv.tv_usec) / 1000;
- stat_accm_add(stat_acct_query_1m, dt);
- stat_accm_add(stat_acct_query_5m, dt);
+ stat_accm_add(rpd->acct_req->serv->stat_acct_query_1m, dt);
+ stat_accm_add(rpd->acct_req->serv->stat_acct_query_5m, dt);
if (rpd->acct_req->reply->id != rpd->acct_req->pack->id || rpd->acct_req->reply->code != CODE_ACCOUNTING_RESPONSE) {
rad_packet_free(rpd->acct_req->reply);
rpd->acct_req->reply = NULL;
rpd->acct_req->pack->id++;
- __sync_add_and_fetch(&stat_acct_lost, 1);
- stat_accm_add(stat_acct_lost_1m, 1);
- stat_accm_add(stat_acct_lost_5m, 1);
+ __sync_add_and_fetch(&rpd->acct_req->serv->stat_acct_lost, 1);
+ stat_accm_add(rpd->acct_req->serv->stat_acct_lost_1m, 1);
+ stat_accm_add(rpd->acct_req->serv->stat_acct_lost_5m, 1);
} else
break;
}
@@ -422,26 +423,26 @@ void rad_acct_stop(struct radius_pd_t *rpd)
}
if (rad_req_send(rpd->acct_req, conf_verbose))
break;
- __sync_add_and_fetch(&stat_acct_sent, 1);
+ __sync_add_and_fetch(&rpd->acct_req->serv->stat_acct_sent, 1);
rad_req_wait(rpd->acct_req, conf_timeout);
if (!rpd->acct_req->reply) {
- __sync_add_and_fetch(&stat_acct_lost, 1);
- stat_accm_add(stat_acct_lost_1m, 1);
- stat_accm_add(stat_acct_lost_5m, 1);
+ __sync_add_and_fetch(&rpd->acct_req->serv->stat_acct_lost, 1);
+ stat_accm_add(rpd->acct_req->serv->stat_acct_lost_1m, 1);
+ stat_accm_add(rpd->acct_req->serv->stat_acct_lost_5m, 1);
continue;
}
dt = (rpd->acct_req->reply->tv.tv_sec - rpd->acct_req->pack->tv.tv_sec) * 1000 +
(rpd->acct_req->reply->tv.tv_usec - rpd->acct_req->pack->tv.tv_usec) / 1000;
- stat_accm_add(stat_acct_query_1m, dt);
- stat_accm_add(stat_acct_query_5m, dt);
+ stat_accm_add(rpd->acct_req->serv->stat_acct_query_1m, dt);
+ stat_accm_add(rpd->acct_req->serv->stat_acct_query_5m, dt);
if (rpd->acct_req->reply->id != rpd->acct_req->pack->id || rpd->acct_req->reply->code != CODE_ACCOUNTING_RESPONSE) {
rad_packet_free(rpd->acct_req->reply);
rpd->acct_req->reply = NULL;
- __sync_add_and_fetch(&stat_acct_lost, 1);
- stat_accm_add(stat_acct_lost_1m, 1);
- stat_accm_add(stat_acct_lost_5m, 1);
+ __sync_add_and_fetch(&rpd->acct_req->serv->stat_acct_lost, 1);
+ stat_accm_add(rpd->acct_req->serv->stat_acct_lost_1m, 1);
+ stat_accm_add(rpd->acct_req->serv->stat_acct_lost_5m, 1);
} else
break;
}