[PATCH 7/7] Multiple udp ports for the same site (multiple "comm"s)

Richard Kettlewell rjk at terraraq.org.uk
Sun Jul 24 14:24:54 BST 2011


> @@ -1310,7 +1312,20 @@ static list_t *site_apply(closure_t *self, struct cloc loc, dict_t *context,
>       st->index = ++index_sequence;
>       st->peer_mobile=dict_read_bool(dict,"mobile",False,"site",loc,False);
>       st->netlink=find_cl_if(dict,"link",CL_NETLINK,True,"site",loc);
> -    st->comm=find_cl_if(dict,"comm",CL_COMM,True,"site",loc);
> +
> +    list_t *comms_cfg=dict_lookup(dict,"comm");
> +    if (!comms_cfg) cfgfatal(loc,"site","closure list \"comm\" not found");
> +    st->ncomms=list_length(comms_cfg);
> +    st->comms=safe_malloc_ary(sizeof(*st->comms),st->ncomms,"comms");
> +    assert(st->ncomms);

Another tangent: maybe find_cl_if() and dict_find_item() should error if 
they find a list with length greater than 1.  Adding such a check 
doesn't break my test rig so there's at least some reason to think it 
benign l-)

I'll include a proposed change in my next patch set.

ttfn/rjk



More information about the sgo-software-discuss mailing list