diff options
author | Yann Ylavic <ylavic@apache.org> | 2018-04-04 17:43:46 +0000 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2018-04-04 17:43:46 +0000 |
commit | 8276a99ce92d603d62c233059495b8d08f3c2c0f (patch) | |
tree | 4c48ccd2b4f27dc0b19f55eb2e9655dd7a2c37e9 /util-misc | |
parent | 6994e19acf72004cf17de9aede8aba6c728e9f6c (diff) | |
download | apr-8276a99ce92d603d62c233059495b8d08f3c2c0f.tar.gz |
reslist: follow up to r1828289: adjust maintenance top too.
Also, clarify in doxygen when apr_reslist_fifo_set() should be called.
[Reverted by r1829102]
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1828369 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'util-misc')
-rw-r--r-- | util-misc/apr_reslist.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/util-misc/apr_reslist.c b/util-misc/apr_reslist.c index 48c4d36ce..ddc9eb5ea 100644 --- a/util-misc/apr_reslist.c +++ b/util-misc/apr_reslist.c @@ -229,8 +229,13 @@ APR_DECLARE(apr_status_t) apr_reslist_maintain(apr_reslist_t *reslist) /* Check if we need to expire old resources */ now = apr_time_now(); while (reslist->nidle > reslist->smax && reslist->nidle > 0) { - /* Peak at the last resource in the list */ - res = APR_RING_LAST(&reslist->avail_list); + /* Peek at the next expiring resource in the list */ + if (reslist->fifo) { + res = APR_RING_FIRST(&reslist->avail_list); + } + else { + res = APR_RING_LAST(&reslist->avail_list); + } /* See if the oldest entry should be expired */ if (now - res->freed < reslist->ttl) { /* If this entry is too young, none of the others |