diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2018-02-19 12:03:58 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2018-02-19 12:06:16 +0300 |
commit | 120d9cb4b14fb524d71924db96cca0d91a5ca281 (patch) | |
tree | c50bd93f875ed1180686e5b2b95ae7e64cabf498 | |
parent | 435c18ba35f9515727e63b4de92912d7567b5534 (diff) | |
download | accel-ppp-120d9cb4b14fb524d71924db96cca0d91a5ca281.tar.gz accel-ppp-120d9cb4b14fb524d71924db96cca0d91a5ca281.zip |
radius: fixed invalid behaviour when route to radius server is not existing
-rw-r--r-- | accel-pppd/radius/req.c | 2 | ||||
-rw-r--r-- | 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; |