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 ? 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). Perhaps the comment should explain what and why the magic is supposed to achieve instead of stating what the c code is obviously doing ?
Cheers, Marek