summaryrefslogtreecommitdiff
path: root/accel-pppd/radius/radius.c
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2012-09-05 23:24:51 +0400
committerKozlov Dmitry <xeb@mail.ru>2012-09-05 23:24:51 +0400
commit490f6384f6a54e388587329c0309a6602d5544e8 (patch)
tree5e70a9e4e7a8f6714a4694826ec68f293d1e55a8 /accel-pppd/radius/radius.c
parenta10ec0f4636cd559209659304709924daad96340 (diff)
downloadaccel-ppp-490f6384f6a54e388587329c0309a6602d5544e8.tar.gz
accel-ppp-490f6384f6a54e388587329c0309a6602d5544e8.zip
generalize interface statistics gathering
Diffstat (limited to 'accel-pppd/radius/radius.c')
-rw-r--r--accel-pppd/radius/radius.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c
index 5f5d0ba..67c18e6 100644
--- a/accel-pppd/radius/radius.c
+++ b/accel-pppd/radius/radius.c
@@ -235,19 +235,18 @@ static void session_timeout(struct triton_timer_t *t)
static void idle_timeout(struct triton_timer_t *t)
{
struct radius_pd_t *rpd = container_of(t, typeof(*rpd), idle_timeout);
- struct rtnl_link_stats stats;
+ time_t tt;
if (rpd->ses->stop_time)
return;
- rad_read_stats(rpd, &stats);
+ time(&tt);
- if (stats.rx_packets == rpd->acct_rx_packets && stats.tx_packets == rpd->acct_tx_packets) {
+ ap_session_read_stats(rpd->ses, NULL);
+
+ if (tt - rpd->ses->idle_time > t->period / 1000) {
log_ppp_msg("radius: idle timed out\n");
ap_session_terminate(rpd->ses, TERM_IDLE_TIMEOUT, 0);
- } else {
- rpd->acct_rx_packets = stats.rx_packets;
- rpd->acct_tx_packets = stats.tx_packets;
}
}