From 120d9cb4b14fb524d71924db96cca0d91a5ca281 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Mon, 19 Feb 2018 12:03:58 +0300 Subject: radius: fixed invalid behaviour when route to radius server is not existing --- accel-pppd/radius/req.c | 2 +- accel-pppd/radius/serv.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/accel-pppd/radius/req.c b/accel-pppd/radius/req.c index b09b880..b6c4cf0 100644 --- a/accel-pppd/radius/req.c +++ b/accel-pppd/radius/req.c @@ -313,7 +313,7 @@ int __rad_req_send(struct rad_req_t *req, int async) } if (req->hnd.fd == -1 && make_socket(req)) - return -1; + return -2; if (req->before_send && req->before_send(req)) goto out_err; diff --git a/accel-pppd/radius/serv.c b/accel-pppd/radius/serv.c index 7372fdc..64db6cd 100644 --- a/accel-pppd/radius/serv.c +++ b/accel-pppd/radius/serv.c @@ -227,8 +227,17 @@ int rad_server_req_enter(struct rad_req_t *req) if (req->send) { r = req->send(req, 0); - if (r) - req->active = 0; + if (r) { + if (r == -2) { + req->active = 0; + pthread_mutex_lock(&req->serv->lock); + req->serv->req_cnt--; + pthread_mutex_unlock(&req->serv->lock); + + rad_server_fail(req->serv); + } else + rad_server_req_exit(req); + } } return r; -- cgit v1.2.3