diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2014-07-11 14:30:43 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-07-11 14:30:43 +0400 |
commit | ca96af9c783f0aa01d89f3226e91014a77f7624f (patch) | |
tree | d4aa17ce2ff17e6fe2e04a8c1cdb3b87b746a1f7 /accel-pppd/radius/serv.c | |
parent | 1cc4499b0244ccd82c2f99d1a2c3ff6632bd5b40 (diff) | |
download | accel-ppp-ca96af9c783f0aa01d89f3226e91014a77f7624f.tar.gz accel-ppp-ca96af9c783f0aa01d89f3226e91014a77f7624f.zip |
radius: fixed handling socket errors during interim updates
Diffstat (limited to 'accel-pppd/radius/serv.c')
-rw-r--r-- | accel-pppd/radius/serv.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/accel-pppd/radius/serv.c b/accel-pppd/radius/serv.c index 46d064a..3d01057 100644 --- a/accel-pppd/radius/serv.c +++ b/accel-pppd/radius/serv.c @@ -6,6 +6,7 @@ #include <unistd.h> #include <sched.h> #include <time.h> +#include <assert.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -151,6 +152,7 @@ void rad_server_req_exit(struct rad_req_t *req) pthread_mutex_lock(&req->serv->lock); req->serv->req_cnt--; + assert(req->serv->req_cnt >= 0); if (req->serv->req_cnt < req->serv->req_limit && !list_empty(&req->serv->req_queue)) { r = list_entry(req->serv->req_queue.next, typeof(*r), entry); list_del(&r->entry); @@ -200,8 +202,8 @@ void rad_server_fail(struct rad_server_t *s) pthread_mutex_lock(&s->lock); - if (ts.tv_sec > s->fail_time) { - s->fail_time = ts.tv_sec + s->conf_fail_time; + if (ts.tv_sec >= s->fail_time) { + s->fail_time = ts.tv_sec + s->conf_fail_time + 1; log_ppp_warn("radius: server(%i) not responding\n", s->id); log_warn("radius: server(%i) not responding\n", s->id); } |