diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2014-08-25 17:23:39 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-08-25 17:23:39 +0400 |
commit | 1def743e8dd5b2eaaa0b1d3e4b5c4d9f400b915a (patch) | |
tree | 146fb05ee9eac88d14eb533b38511f5843a4ba8d | |
parent | 2cdd67782c6d11af141992dba2943e03134593b5 (diff) | |
download | accel-ppp-1def743e8dd5b2eaaa0b1d3e4b5c4d9f400b915a.tar.gz accel-ppp-1def743e8dd5b2eaaa0b1d3e4b5c4d9f400b915a.zip |
radius: delete timeout timer if request sending fails (fixes double server release)
-rw-r--r-- | accel-pppd/radius/acct.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/accel-pppd/radius/acct.c b/accel-pppd/radius/acct.c index 993ff22..9a5e549 100644 --- a/accel-pppd/radius/acct.c +++ b/accel-pppd/radius/acct.c @@ -124,13 +124,8 @@ static int __rad_req_send(struct rad_req_t *req) { while (1) { if (rad_server_req_enter(req)) { - if (rad_server_realloc(req)) { - if (conf_acct_timeout) { - log_ppp_warn("radius:acct: no servers available, terminating session...\n"); - ap_session_terminate(req->rpd->ses, TERM_NAS_ERROR, 0); - } + if (rad_server_realloc(req)) return -1; - } continue; } @@ -177,11 +172,13 @@ static void rad_acct_timeout(struct triton_timer_t *t) rad_server_fail(req->serv); if (rad_server_realloc(req)) { log_ppp_warn("radius:acct: no servers available, terminating session...\n"); + triton_timer_del(t); ap_session_terminate(req->rpd->ses, TERM_NAS_ERROR, 0); return; } time(&req->rpd->acct_timestamp); } + if (dt > conf_acct_timeout / 2) { req->timeout.period += 1000; triton_timer_mod(&req->timeout, 0); @@ -198,8 +195,16 @@ static void rad_acct_timeout(struct triton_timer_t *t) req_set_RA(req, req->serv->secret); } - if (__rad_req_send(req)) + if (__rad_req_send(req)) { + triton_timer_del(t); + + if (conf_acct_timeout) { + log_ppp_warn("radius:acct: no servers available, terminating session...\n"); + ap_session_terminate(req->rpd->ses, TERM_NAS_ERROR, 0); + } + return; + } __sync_add_and_fetch(&req->serv->stat_interim_sent, 1); } |