diff options
Diffstat (limited to 'accel-pppd')
-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 fb5183b..84a4f3d 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 43778ca..b4b423d 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); |