diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2014-10-06 17:02:45 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-10-06 17:02:45 +0400 |
commit | e994bbe0e602b455cc46555f3feccfbee70e685c (patch) | |
tree | 148704b0a898808cc00e81a895d1f8d77713cb22 /accel-pppd/radius/serv.c | |
parent | 43a444fc65d917bf680831c0b942d682d933dc84 (diff) | |
download | accel-ppp-e994bbe0e602b455cc46555f3feccfbee70e685c.tar.gz accel-ppp-e994bbe0e602b455cc46555f3feccfbee70e685c.zip |
radius: fixed Accounting-On/Accounting-Off functionality
Diffstat (limited to 'accel-pppd/radius/serv.c')
-rw-r--r-- | accel-pppd/radius/serv.c | 22 |
1 files changed, 12 insertions, 10 deletions
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); |