- current_type = ntohl (atsi[c1].type);
-
- for (c2 = 0; c2 < GNUNET_ATS_QualityPropertiesCount; c2++)
- if (current_type == properties[c2].atsi_type)
- break;
- if (GNUNET_ATS_QualityPropertiesCount == c2)
- {
- /* Not a quality property, continue with next element */
- continue;
- }
- /* Calculate running average */
- old = address->atsin[c2].avg;
- property_average (&address->atsin[c2],
- &atsi[c1]);
- if (old == address->atsin[c2].avg)
- continue; /* no change */
- range_changed = GNUNET_NO;
- if ( (old == properties[c2].min) ||
- (old == properties[c2].max) ||
- (address->atsin[c2].avg < properties[c2].min) ||
- (address->atsin[c2].avg > properties[c2].max) )
- {
- /* need to re-calculate min/max range, as it may have changed */
- find_ctx.p = &properties[c2];
- find_ctx.max = 0;
- find_ctx.min = UINT32_MAX;
- if (0 ==
- GNUNET_CONTAINER_multipeermap_iterate (GSA_addresses,
- &find_min_max_it,
- &find_ctx))
- {
- GNUNET_break(0);
- continue;
- }
- if ( (find_ctx.min != properties[c2].min) ||
- (find_ctx.max != properties[c2].max) )
- {
- properties[c2].min = find_ctx.min;
- properties[c2].max = find_ctx.max;
- /* limits changed, (re)normalize all addresses */
- range_changed = GNUNET_YES;
- }
- }
- if (GNUNET_YES == range_changed)
- GNUNET_CONTAINER_multipeermap_iterate (GSA_addresses,
- &normalize_address,
- &properties[c2]);
- else
- normalize_address (&properties[c2],
- &address->peer,
- address);
- /* after all peers have been updated, notify about changes */
- if (GNUNET_YES == range_changed)
- GNUNET_CONTAINER_multipeermap_iterate (GSA_addresses,
- ¬ify_change,
- &properties[c2]);
- else
- notify_change (&properties[c2],
- &address->peer,
- address);
-
+ /* limits changed, (re)normalize all addresses */
+ property_range = range;
+ GNUNET_CONTAINER_multipeermap_iterate (GSA_addresses,
+ &normalize_address,
+ NULL);
+ GNUNET_CONTAINER_multipeermap_iterate (GSA_addresses,
+ ¬ify_change,
+ NULL);
+ }
+ else
+ {
+ /* renormalize just this one address */
+ normalize_address (NULL,
+ &address->peer,
+ address);
+ notify_change (NULL,
+ &address->peer,
+ address);