apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: apr_skiplist (current) implementation wrt mpm_event (timers, keepalives?)
Date Tue, 27 May 2014 13:52:08 GMT
Adding dev@apr
On May 22, 2014, at 6:04 AM, Yann Ylavic <ylavic.dev@gmail.com> wrote:

> Hello,
> 
> while working on
> https://issues.apache.org/bugzilla/show_bug.cgi?id=56226 for a
> possible way to use vhost's KeepAliveTimeout with mpm_event (by using
> a skiplist instead of the actual keepalive queue), I realized that
> apr_skiplists do not accept multiple values per key (unlike apr_table
> for example, or std::multimap).
> 
> AFAICT this is only an implementation choice, which could be changed
> with something like :
> Index: tables/apr_skiplist.c
> ===================================================================
> --- tables/apr_skiplist.c    (revision 1595631)
> +++ tables/apr_skiplist.c    (working copy)
> @@ -406,11 +406,7 @@ APR_DECLARE(apr_skiplistnode *) apr_skiplist_inser
>         if (m->next) {
>             compared = comp(data, m->next->data);
>         }
> -        if (compared == 0) {
> -            free(stack);    /* OK. was malloc'ed */
> -            return 0;
> -        }
> -        if ((m->next == NULL) || (compared < 0)) {
> +        if (compared < 0) {
>             if (ch <= nh) {
>                 /* push on stack */
>                 stack[stacki++] = m;
> 
> (probably with a new apr_skiplist_set_multi() which would make it controlable).
> 

+1 on extending skiplist for multi-values per key.

Maybe have apr_skiplist_set for current insert behavior and
apr_skiplist_add() for multi-value option... We can then
deprecate _insert.

Good for apr-1.6.


Mime
View raw message