diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2014-10-23 14:44:32 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-10-23 14:44:32 +0400 |
commit | 2305d7b30b13058efce059fcc7e6f370d43214d3 (patch) | |
tree | 6fb1db6de334bc9de6a711c85e931d2ee3e3af40 /accel-pppd/radius | |
parent | d30d6a5f2605aee09137e75f471cc511c3e0d961 (diff) | |
download | accel-ppp-2305d7b30b13058efce059fcc7e6f370d43214d3.tar.gz accel-ppp-2305d7b30b13058efce059fcc7e6f370d43214d3.zip |
radius: fixed server reallocation for queued requests if current server does not respond
Diffstat (limited to 'accel-pppd/radius')
-rw-r--r-- | accel-pppd/radius/req.c | 7 | ||||
-rw-r--r-- | accel-pppd/radius/serv.c | 8 |
2 files changed, 12 insertions, 3 deletions
diff --git a/accel-pppd/radius/req.c b/accel-pppd/radius/req.c index fb5183bc..84a4f3d9 100644 --- a/accel-pppd/radius/req.c +++ b/accel-pppd/radius/req.c @@ -305,7 +305,8 @@ int __rad_req_send(struct rad_req_t *req, int async) { if (async == -1) { req->try = conf_max_try - 1; - rad_req_send(req); + if (rad_req_send(req)) + req->sent(req, -1); return 0; } @@ -351,8 +352,8 @@ int rad_req_send(struct rad_req_t *req) req->send = __rad_req_send; if (req->try++ == conf_max_try) { - rad_server_req_exit(req); rad_server_fail(req->serv); + rad_server_req_exit(req); if (rad_server_realloc(req)) { if (req->rpd) @@ -393,6 +394,8 @@ int rad_req_read(struct triton_md_handler_t *h) while (1) { if (rad_packet_recv(h->fd, &pack, NULL)) return 0; + + rad_server_reply(req->serv); if (pack->id == req->pack->id) break; diff --git a/accel-pppd/radius/serv.c b/accel-pppd/radius/serv.c index 43778ca1..b4b423d2 100644 --- a/accel-pppd/radius/serv.c +++ b/accel-pppd/radius/serv.c @@ -131,6 +131,11 @@ static void req_wakeup(struct rad_req_t *req) req->send(req, 1); } +static void req_wakeup_failed(struct rad_req_t *req) +{ + req->send(req, -1); +} + int rad_server_req_cancel(struct rad_req_t *req, int full) { int r = 0; @@ -287,8 +292,9 @@ void rad_server_fail(struct rad_server_t *s) while (!list_empty(&s->req_queue)) { r = list_entry(s->req_queue.next, typeof(*r), entry); list_del(&r->entry); - triton_context_call(r->rpd->ses->ctrl->ctx, (triton_event_func)req_wakeup, r); + triton_context_call(r->rpd ? r->rpd->ses->ctrl->ctx : NULL, (triton_event_func)req_wakeup_failed, r); } + s->queue_cnt = 0; } pthread_mutex_unlock(&s->lock); |