summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accel-pppd/radius/acct.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/accel-pppd/radius/acct.c b/accel-pppd/radius/acct.c
index 69bd3d56..d30aae7a 100644
--- a/accel-pppd/radius/acct.c
+++ b/accel-pppd/radius/acct.c
@@ -373,6 +373,16 @@ static void rad_acct_stop_sent(struct rad_req_t *req, int res)
rpd->acct_req = NULL;
} else if (req->rpd)
rad_acct_stop_defer(req->rpd);
+ else {
+ /* deferred request: the timeout timer is one-shot and
+ * nobody else references this request, re-arm it to
+ * retry later, otherwise the request and its socket
+ * leak */
+ if (req->timeout.tpd)
+ triton_timer_mod(&req->timeout, 0);
+ else
+ triton_timer_add(NULL, &req->timeout, 0);
+ }
return;
}
@@ -423,7 +433,7 @@ static void rad_acct_stop_timeout(struct triton_timer_t *t)
req->pack->id++;
}
- if (req->try == conf_max_try) {
+ if (req->try >= conf_max_try) {
if (req->rpd)
req->rpd->acct_req = NULL;
rad_req_free(req);
@@ -437,7 +447,14 @@ static void rad_acct_stop_timeout(struct triton_timer_t *t)
rad_req_free(req);
return;
}
- req->try = 0;
+ /* no server available at the moment; the timeout timer is
+ * one-shot, re-arm it to retry later, otherwise the request
+ * and its socket leak; failed attempts count towards
+ * conf_max_try so the request is freed above eventually */
+ if (req->timeout.tpd)
+ triton_timer_mod(&req->timeout, 0);
+ else
+ triton_timer_add(req->rpd ? req->rpd->ses->ctrl->ctx : NULL, &req->timeout, 0);
}
}