Re: RFC: acl_list reverse reference

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sun, 19 May 2002 19:14:17 +0200

I don't quite get how this defines "N", or when you plan on calling
"aclRoundRobin"..

Can you try to explain your proposed design in words?

Regards
Henrik

On Thursday 16 May 2002 09:31, Zwane Mwaikambo wrote:
> Hi,
> How does this look for a starter on providing a select 1 of N
> method. This uses acl_list as the list. This would then allow us to
> utilise it with other objects.
>
> Index: squid-2.5/src/acl.c
> ===================================================================
> RCS file: /build/cvsroot/squid-2.5/src/acl.c,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 acl.c
> --- squid-2.5/src/acl.c 14 May 2002 18:06:47 -0000 1.1.1.1
> +++ squid-2.5/src/acl.c 15 May 2002 19:22:09 -0000
> @@ -1721,6 +1721,31 @@
> return 0;
> }
>
> +void *
> +aclRoundRobin(const acl_list * list)
> +{
> + static acl_list *pos = NULL;
> + int cycles = 0;
> + acl_list *ret;
> +
> +try_again:
> + if (pos == NULL) {
> + pos = list;
> + if (cycles++ > 0)
> + return NULL;
> + }
> +
> + if (pos->contendor) {
> + ret = pos;
> + pos = pos->next;
> + } else {
> + pos = pos->next;
> + goto try_again;
> + }
> +
> + return ret->this;
> +}
> +
> int
> aclMatchAclList(const acl_list * list, aclCheck_t * checklist)
> {
> Index: squid-2.5/src/cache_cf.c
> ===================================================================
> RCS file: /build/cvsroot/squid-2.5/src/cache_cf.c,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 cache_cf.c
> --- squid-2.5/src/cache_cf.c 14 May 2002 18:06:47 -0000 1.1.1.1
> +++ squid-2.5/src/cache_cf.c 15 May 2002 18:55:26 -0000
> @@ -655,6 +655,7 @@
> CBDATA_INIT_TYPE_FREECB(acl_address, freed_acl_address);
> l = cbdataAlloc(acl_address);
> parse_address(&l->addr);
> + l->acl_list.this = l;
> aclParseAclList(&l->acl_list);
> while (*tail)
> tail = &(*tail)->next;
> @@ -711,6 +712,7 @@
> CBDATA_INIT_TYPE_FREECB(acl_tos, freed_acl_tos);
> l = cbdataAlloc(acl_tos);
> l->tos = tos;
> + l->acl_list.this = l;
> aclParseAclList(&l->acl_list);
> while (*tail)
> tail = &(*tail)->next;
> Index: squid-2.5/src/structs.h
> ===================================================================
> RCS file: /build/cvsroot/squid-2.5/src/structs.h,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 structs.h
> --- squid-2.5/src/structs.h 14 May 2002 18:06:47 -0000 1.1.1.1
> +++ squid-2.5/src/structs.h 15 May 2002 19:01:45 -0000
> @@ -251,6 +251,8 @@
> int op;
> acl *acl;
> acl_list *next;
> + int contendor;
> + void *this;
> };
>
> struct _acl_access {
Received on Sun May 19 2002 - 17:09:54 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:15:28 MST