On Sat, Feb 11, 2012 at 09:59:57PM +0800, Marek Lindner wrote:
> On Friday, February 10, 2012 07:41:36 Antonio Quartulli wrote:
> > + for (select = 0; select < DHT_CANDIDATES_NUM; select++) {
> > + max = 0;
> > + max_orig_node = NULL;
> > + if (!chosen_me) {
> > + /* if true, wrap around the key space */
> > + if (bat_priv->dht_hash > ip_key)
> > + max = DAT_ADDR_MAX - bat_priv->dht_hash +
> > + ip_key;
> > + else
> > + max = ip_key - bat_priv->dht_hash;
> > + max = bat_priv->dht_hash;
>
> Somehow this does not make sense to me. Why do we calculate a magic value for
> "max" if we set it to bat_priv->dht_hash afterwards ?Thank you, actually I didn't spot it in the tests because of the limited number of nodes involved. I thought they were enough. > Moreover, the name dht_hash is a bit confusing. At first I thought it is a > pointer to a hash (read: orig_hash/tt_local_hash/tt_global_hash/etc). ok, I'll rename it to dht_id (or dht_addr ?) > Perhaps > the comment should explain what and why the magic is supposed to achieve > instead of stating what the c code is obviously doing ? > I agree :-) Thanks! Cheers, -- Antonio Quartulli ..each of us alone is worth nothing.. Ernesto "Che" Guevara
pgpOqKckOPSdf.pgp
Description: PGP signature
