From e994bbe0e602b455cc46555f3feccfbee70e685c Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Mon, 6 Oct 2014 17:02:45 +0400 Subject: radius: fixed Accounting-On/Accounting-Off functionality --- accel-pppd/radius/serv.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'accel-pppd/radius/serv.c') diff --git a/accel-pppd/radius/serv.c b/accel-pppd/radius/serv.c index 664c11dd..66931353 100644 --- a/accel-pppd/radius/serv.c +++ b/accel-pppd/radius/serv.c @@ -346,23 +346,25 @@ static void acct_on_timeout(struct triton_timer_t *t) struct rad_req_t *req = container_of(t, typeof(*req), timeout); struct rad_server_t *s = req->serv; - if (!s->starting && ++req->serv->req_cnt == conf_max_try) { + log_switch(triton_context_self(), NULL); + + if (req->try++ == conf_max_try) { rad_req_free(req); - __free_server(s); + if (s->starting) + s->starting = 0; + else + __free_server(s); return; } - req->try = 1; - - rad_req_send(req); + __rad_req_send(req, 0); } static void send_acct_on(struct rad_server_t *s) { - struct rad_req_t *req = _malloc(sizeof(*req)); - - if (!req) - return; + struct rad_req_t *req = rad_req_alloc_empty(); + + log_switch(triton_context_self(), NULL); memset(req, 0, sizeof(*req)); req->hnd.fd = -1; @@ -398,7 +400,7 @@ static void send_acct_on(struct rad_server_t *s) if (req_set_RA(req, s->secret)) goto out_err; - rad_req_send(req); + __rad_req_send(req, 0); triton_timer_add(&s->ctx, &req->timeout, 0); -- cgit v1.2.3