aboutsummaryrefslogtreecommitdiff
path: root/src/ats
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-11-19 16:42:03 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-11-19 16:42:03 +0000
commit94a6bb6f521b4d57a10035ad294b4c8ef58f01ff (patch)
tree0357438d1a30092487866a990989e77b5a70e571 /src/ats
parent52acb8f4435955e07aa7694e96a1ab732c9c730d (diff)
downloadgnunet-94a6bb6f521b4d57a10035ad294b4c8ef58f01ff.tar.gz
gnunet-94a6bb6f521b4d57a10035ad294b4c8ef58f01ff.zip
evaluation
Diffstat (limited to 'src/ats')
-rw-r--r--src/ats/gnunet-service-ats_addresses.c115
-rw-r--r--src/ats/gnunet-service-ats_normalization.c109
-rw-r--r--src/ats/gnunet-service-ats_normalization.h10
-rw-r--r--src/ats/test_ats_solver_preferences.c10
4 files changed, 142 insertions, 102 deletions
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index 833a26c41..be0e03031 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -1342,6 +1342,7 @@ eval_count_active_it (void *cls, const struct GNUNET_PeerIdentity *id, void *obj
1342 return GNUNET_YES; 1342 return GNUNET_YES;
1343} 1343}
1344 1344
1345
1345/** 1346/**
1346 * Summary context 1347 * Summary context
1347 */ 1348 */
@@ -1401,33 +1402,20 @@ struct RelativityContext {
1401 struct GAS_Addresses_Handle *ah; 1402 struct GAS_Addresses_Handle *ah;
1402}; 1403};
1403 1404
1404#if 0
1405static int 1405static int
1406eval_preference_relativity (void *cls, const struct GNUNET_PeerIdentity *id, void *obj) 1406find_active_address (void *cls, const struct GNUNET_PeerIdentity *id, void *obj)
1407{ 1407{
1408 struct RelativityContext *rc = cls; 1408 struct ATS_Address **res = cls;
1409 struct ATS_Address *addr = obj; 1409 struct ATS_Address *addr = obj;
1410 int prefs[GNUNET_ATS_PreferenceCount] = GNUNET_ATS_PreferenceType ;
1411 int c;
1412 const double *preferences;
1413 1410
1414 if (GNUNET_YES == addr->active) 1411 if (GNUNET_YES == addr->active)
1415 { 1412 (*res) = addr;
1416 preferences = get_preferences_cb (rc->ah->env.get_preference_cls, id);
1417 for (c = 0; c < GNUNET_ATS_PreferenceCount; c++)
1418 {
1419 if (prefs[c] == GNUNET_ATS_PREFERENCE_END)
1420 continue;
1421 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Preference for peer `%s' type %s: %f\n",
1422 GNUNET_i2s (id), GNUNET_ATS_print_preference_type(prefs[c]),
1423 preferences[c]);
1424 }
1425 }
1426 1413
1427 return GNUNET_OK; 1414 if (NULL != (*res))
1415 return GNUNET_NO;
1416 else
1417 return GNUNET_YES;
1428} 1418}
1429#endif
1430
1431 1419
1432/** 1420/**
1433 * Evaluate current bandwidth assignment 1421 * Evaluate current bandwidth assignment
@@ -1458,11 +1446,17 @@ GAS_addresses_evaluate_assignment (struct GAS_Addresses_Handle *ah)
1458 1446
1459 /* Variable related to utilization */ 1447 /* Variable related to utilization */
1460 struct SummaryContext sum; 1448 struct SummaryContext sum;
1449 struct ATS_Address *active_address;
1461 int network_count; 1450 int network_count;
1462 1451
1463 /* Variables for preferences */ 1452 /* Variables for preferences */
1464 int prefs[GNUNET_ATS_PreferenceCount] = GNUNET_ATS_PreferenceType; 1453 int prefs[GNUNET_ATS_PreferenceCount] = GNUNET_ATS_PreferenceType;
1465 double pref_val; 1454 double pref_val;
1455 double prop_val;
1456 const double *norm_values;
1457 double prefs_fulfill[GNUNET_ATS_PreferenceCount];
1458 int prefs_clients[GNUNET_ATS_PreferenceCount];
1459 int rels;
1466 1460
1467 GNUNET_assert (NULL != ah); 1461 GNUNET_assert (NULL != ah);
1468 GNUNET_assert (NULL != ah->addresses); 1462 GNUNET_assert (NULL != ah->addresses);
@@ -1540,25 +1534,80 @@ GAS_addresses_evaluate_assignment (struct GAS_Addresses_Handle *ah)
1540 } 1534 }
1541 else 1535 else
1542 { 1536 {
1543 for (pcur = ah->preference_clients_head; NULL != pcur; pcur = pcur->next) 1537 for (c = 0; c < GNUNET_ATS_PreferenceCount; c++)
1544 { 1538 {
1545 /* V metrics*/ 1539 prefs_fulfill[c] = 0.0;
1546 for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) 1540 prefs_clients[c] = 0;
1547 { 1541 }
1548 1542
1549 if (prefs[c] == GNUNET_ATS_PREFERENCE_END) 1543 for (cur = ah->pending_requests_head; NULL != cur; cur = cur->next)
1550 continue; 1544 {
1551 pref_val = -1.0; 1545 active_address = NULL;
1552 pref_val = GAS_normalization_get_preferences_by_client (pcur->client, prefs[c]); 1546 GNUNET_CONTAINER_multipeermap_get_multiple (ah->addresses,
1553 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "normalized pref for client %p == %.3f\n", 1547 &cur->id, &find_active_address, &active_address);
1554 pcur->client, pref_val); 1548
1555 if (-1.0 == pref_val) 1549 for (pcur = ah->preference_clients_head; NULL != pcur; pcur = pcur->next)
1550 {
1551 for (c = 0; c < GNUNET_ATS_PreferenceCount; c++)
1556 { 1552 {
1557 GNUNET_break (0); 1553 if (prefs[c] == GNUNET_ATS_PREFERENCE_END)
1558 continue; 1554 continue;
1555 pref_val = -1.0;
1556 pref_val = GAS_normalization_get_preferences_by_client (pcur->client, &cur->id, prefs[c]);
1557 if (-1.0 == pref_val)
1558 {
1559 GNUNET_break (0);
1560 continue;
1561 }
1562
1563 if (DEFAULT_REL_PREFERENCE == pref_val)
1564 {
1565 /* Default preference value */
1566 continue;
1567 }
1568
1569 if (NULL != active_address)
1570 {
1571 norm_values = GAS_normalization_get_properties (active_address);
1572 prop_val = norm_values[c];
1573 if ((norm_values[c] <= 1.0) || (norm_values[c] >= 2.0))
1574 prop_val = DEFAULT_REL_QUALITY;
1575 }
1576 else
1577 {
1578 prop_val = DEFAULT_REL_QUALITY;
1579 }
1580
1581 /* We now have preference values [1..2] and properties [1..2] */
1582
1583 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u Client %p, Peer %s Property %s: pref: %.3f prop %.3f \n",
1584 c,
1585 pcur->client,
1586 GNUNET_i2s (&cur->id),
1587 GNUNET_ATS_print_preference_type(prefs[c]),
1588 pref_val,
1589 prop_val);
1590
1591 prefs_fulfill[c] += (pref_val * prop_val) / 2;
1592 prefs_clients[c] ++;
1559 } 1593 }
1560 } 1594 }
1561 } 1595 }
1596 rels = 0;
1597 for (c = 0; c < GNUNET_ATS_PreferenceCount; c++)
1598 {
1599 if (0 < prefs_clients[c])
1600 {
1601 prefs_fulfill[c] /= prefs_clients[c];
1602 rels ++;
1603 quality_application_requirements += prefs_fulfill[c];
1604 }
1605 }
1606 if (rels > 0)
1607 quality_application_requirements /= rels;
1608 else
1609 quality_application_requirements = 0.0;
1610
1562 include_requirements = GNUNET_YES; 1611 include_requirements = GNUNET_YES;
1563 } 1612 }
1564 /* GUQ */ 1613 /* GUQ */
diff --git a/src/ats/gnunet-service-ats_normalization.c b/src/ats/gnunet-service-ats_normalization.c
index 9a4e72665..470b82129 100644
--- a/src/ats/gnunet-service-ats_normalization.c
+++ b/src/ats/gnunet-service-ats_normalization.c
@@ -220,9 +220,7 @@ update_peers (struct GNUNET_PeerIdentity *id,
220 "%u clients have a total relative preference for peer `%s''s `%s' of %.3f\n", 220 "%u clients have a total relative preference for peer `%s''s `%s' of %.3f\n",
221 count, GNUNET_i2s (id), GNUNET_ATS_print_preference_type (kind), 221 count, GNUNET_i2s (id), GNUNET_ATS_print_preference_type (kind),
222 f_rel_total); 222 f_rel_total);
223 if (NULL 223 if (NULL != (rp = GNUNET_CONTAINER_multipeermap_get (preference_peers, id)))
224 != (rp = GNUNET_CONTAINER_multipeermap_get (preference_peers,
225 id)))
226 { 224 {
227 backup = rp->f_rel[kind]; 225 backup = rp->f_rel[kind];
228 if (0 < count) 226 if (0 < count)
@@ -330,7 +328,7 @@ update_preference (struct PreferenceClient *c, struct PreferencePeer *p,
330 case GNUNET_ATS_PREFERENCE_BANDWIDTH: 328 case GNUNET_ATS_PREFERENCE_BANDWIDTH:
331 case GNUNET_ATS_PREFERENCE_LATENCY: 329 case GNUNET_ATS_PREFERENCE_LATENCY:
332 p->f_abs[kind] = (p->f_abs[kind] + score) / 2; 330 p->f_abs[kind] = (p->f_abs[kind] + score) / 2;
333 p->next_aging[kind] = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), 331 p->next_aging[kind] = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
334 PREF_AGING_INTERVAL); 332 PREF_AGING_INTERVAL);
335 break; 333 break;
336 case GNUNET_ATS_PREFERENCE_END: 334 case GNUNET_ATS_PREFERENCE_END:
@@ -367,24 +365,26 @@ preference_aging (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
367 /* Aging absolute values: */ 365 /* Aging absolute values: */
368 for (i = 0; i < GNUNET_ATS_PreferenceCount; i++) 366 for (i = 0; i < GNUNET_ATS_PreferenceCount; i++)
369 { 367 {
370 if (0 == GNUNET_TIME_absolute_get_remaining(p->next_aging[i]).rel_value_us) 368 if (0
369 == GNUNET_TIME_absolute_get_remaining (p->next_aging[i]).rel_value_us)
371 { 370 {
372 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Aging preference for peer `%s'\n", 371 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
373 GNUNET_i2s (&p->id)); 372 "Aging preference for peer `%s'\n", GNUNET_i2s (&p->id));
374 backup = p->f_abs[i]; 373 backup = p->f_abs[i];
375 if (p->f_abs[i] > DEFAULT_ABS_PREFERENCE) 374 if (p->f_abs[i] > DEFAULT_ABS_PREFERENCE)
376 p->f_abs[i] *= PREF_AGING_FACTOR; 375 p->f_abs[i] *= PREF_AGING_FACTOR;
377 if (p->f_abs[i] <= DEFAULT_ABS_PREFERENCE + PREF_EPSILON) 376 if (p->f_abs[i] <= DEFAULT_ABS_PREFERENCE + PREF_EPSILON)
378 p->f_abs[i] = DEFAULT_ABS_PREFERENCE; 377 p->f_abs[i] = DEFAULT_ABS_PREFERENCE;
379 if ((p->f_abs[i] != DEFAULT_ABS_PREFERENCE) && (backup != p->f_abs[i])) 378 if ((p->f_abs[i] != DEFAULT_ABS_PREFERENCE)
379 && (backup != p->f_abs[i]))
380 { 380 {
381 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 381 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
382 "Aged preference for peer `%s' from %.3f to %.3f\n", 382 "Aged preference for peer `%s' from %.3f to %.3f\n",
383 GNUNET_i2s (&p->id), backup, p->f_abs[i]); 383 GNUNET_i2s (&p->id), backup, p->f_abs[i]);
384 recalculate_rel_preferences (p->client, p, i); 384 recalculate_rel_preferences (p->client, p, i);
385 p->next_aging[i] = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(), 385 p->next_aging[i] = GNUNET_TIME_absolute_add (
386 PREF_AGING_INTERVAL); 386 GNUNET_TIME_absolute_get (), PREF_AGING_INTERVAL);
387 values_to_update ++; 387 values_to_update++;
388 } 388 }
389 } 389 }
390 } 390 }
@@ -393,18 +393,18 @@ preference_aging (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
393 393
394 if (values_to_update > 0) 394 if (values_to_update > 0)
395 { 395 {
396 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 396 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
397 "Rescheduling aging task due to %u elements to age\n", values_to_update); 397 "Rescheduling aging task due to %u elements to age\n",
398 values_to_update);
398 aging_task = GNUNET_SCHEDULER_add_delayed (PREF_AGING_INTERVAL, 399 aging_task = GNUNET_SCHEDULER_add_delayed (PREF_AGING_INTERVAL,
399 &preference_aging, NULL); 400 &preference_aging, NULL );
400 } 401 }
401 else 402 else
402 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 403 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
403 "No values to age left, not rescheduling aging task\n"); 404 "No values to age left, not rescheduling aging task\n");
404 405
405} 406}
406 407
407
408/** 408/**
409 * Normalize an updated preference value 409 * Normalize an updated preference value
410 * 410 *
@@ -415,8 +415,7 @@ preference_aging (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
415 */ 415 */
416void 416void
417GAS_normalization_normalize_preference (void *src, 417GAS_normalization_normalize_preference (void *src,
418 const struct GNUNET_PeerIdentity *peer, 418 const struct GNUNET_PeerIdentity *peer, enum GNUNET_ATS_PreferenceKind kind,
419 enum GNUNET_ATS_PreferenceKind kind,
420 float score_abs) 419 float score_abs)
421{ 420{
422 struct PreferenceClient *c_cur; 421 struct PreferenceClient *c_cur;
@@ -448,9 +447,8 @@ GAS_normalization_normalize_preference (void *src,
448 { 447 {
449 c_cur = GNUNET_malloc (sizeof (struct PreferenceClient)); 448 c_cur = GNUNET_malloc (sizeof (struct PreferenceClient));
450 c_cur->client = src; 449 c_cur->client = src;
451 GNUNET_CONTAINER_DLL_insert (pc_head, pc_tail, c_cur); 450 GNUNET_CONTAINER_DLL_insert(pc_head, pc_tail, c_cur);
452 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 451 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Adding new client %p \n", c_cur);
453 "Adding new client %p \n", c_cur);
454 } 452 }
455 453
456 /* Find entry for peer */ 454 /* Find entry for peer */
@@ -476,20 +474,19 @@ GAS_normalization_normalize_preference (void *src,
476 GNUNET_CONTAINER_DLL_insert(c_cur->p_head, c_cur->p_tail, p_cur); 474 GNUNET_CONTAINER_DLL_insert(c_cur->p_head, c_cur->p_tail, p_cur);
477 } 475 }
478 476
479 if (NULL == GNUNET_CONTAINER_multipeermap_get (preference_peers, 477 if (NULL == GNUNET_CONTAINER_multipeermap_get (preference_peers, peer))
480 peer))
481 { 478 {
482 r_cur = GNUNET_malloc (sizeof (struct PeerRelative)); 479 r_cur = GNUNET_malloc (sizeof (struct PeerRelative));
483 r_cur->id = (*peer); 480 r_cur->id = (*peer);
484 for (i = 0; i < GNUNET_ATS_PreferenceCount; i++) 481 for (i = 0; i < GNUNET_ATS_PreferenceCount; i++)
485 r_cur->f_rel[i] = DEFAULT_REL_PREFERENCE; 482 r_cur->f_rel[i] = DEFAULT_REL_PREFERENCE;
486 GNUNET_CONTAINER_multipeermap_put (preference_peers, &r_cur->id, 483 GNUNET_CONTAINER_multipeermap_put (preference_peers, &r_cur->id, r_cur,
487 r_cur, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); 484 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
488 } 485 }
489 486
490 if (GNUNET_SCHEDULER_NO_TASK == aging_task) 487 if (GNUNET_SCHEDULER_NO_TASK == aging_task)
491 aging_task = GNUNET_SCHEDULER_add_delayed (PREF_AGING_INTERVAL, 488 aging_task = GNUNET_SCHEDULER_add_delayed (PREF_AGING_INTERVAL,
492 &preference_aging, NULL); 489 &preference_aging, NULL );
493 490
494 update_preference (c_cur, p_cur, kind, score_abs); 491 update_preference (c_cur, p_cur, kind, score_abs);
495} 492}
@@ -509,9 +506,7 @@ GAS_normalization_get_preferences_by_peer (const struct GNUNET_PeerIdentity *id)
509 GNUNET_assert(NULL != id); 506 GNUNET_assert(NULL != id);
510 507
511 struct PeerRelative *rp; 508 struct PeerRelative *rp;
512 if (NULL 509 if (NULL == (rp = GNUNET_CONTAINER_multipeermap_get (preference_peers, id)))
513 == (rp = GNUNET_CONTAINER_multipeermap_get (preference_peers,
514 id)))
515 { 510 {
516 return defvalues.f_rel; 511 return defvalues.f_rel;
517 } 512 }
@@ -519,17 +514,19 @@ GAS_normalization_get_preferences_by_peer (const struct GNUNET_PeerIdentity *id)
519} 514}
520 515
521/** 516/**
522 * Get the normalized preference values for a specific peer or 517 * Get the normalized preference values for a specific client and peer
523 * the default values if
524 * 518 *
525 * @param id the peer 519 * @param id the peer
526 * @return pointer to the values, can be indexed with GNUNET_ATS_PreferenceKind, 520 * @param the peer
527 * default preferences if peer does not exist 521 * @return the value
528 */ 522 */
529const double 523const double
530GAS_normalization_get_preferences_by_client (const void *client, enum GNUNET_ATS_PreferenceKind pref) 524GAS_normalization_get_preferences_by_client (const void *client,
525 struct GNUNET_PeerIdentity *peer, enum GNUNET_ATS_PreferenceKind pref)
531{ 526{
532 struct PreferenceClient *c_cur; 527 struct PreferenceClient *c_cur;
528 struct PreferencePeer *p_cur;
529
533 /* Find preference client */ 530 /* Find preference client */
534 for (c_cur = pc_head; NULL != c_cur; c_cur = c_cur->next) 531 for (c_cur = pc_head; NULL != c_cur; c_cur = c_cur->next)
535 { 532 {
@@ -537,9 +534,17 @@ GAS_normalization_get_preferences_by_client (const void *client, enum GNUNET_ATS
537 break; 534 break;
538 } 535 }
539 if (NULL == c_cur) 536 if (NULL == c_cur)
540 return -1; 537 return -1.0;
538
539 for (p_cur = c_cur->p_head; NULL != p_cur; p_cur = p_cur->next)
540 {
541 if (0 == memcmp (peer, &p_cur->id, sizeof (struct GNUNET_PeerIdentity)))
542 break;
543 }
544 if (NULL == p_cur)
545 return DEFAULT_REL_PREFERENCE; /* Not found, return default */
541 546
542 return 1.0; 547 return p_cur->f_rel[pref];
543} 548}
544 549
545/** 550/**
@@ -651,7 +656,6 @@ property_average (struct ATS_Address *address,
651 return res; 656 return res;
652} 657}
653 658
654
655struct FindMinMaxCtx 659struct FindMinMaxCtx
656{ 660{
657 struct Property *p; 661 struct Property *p;
@@ -659,11 +663,8 @@ struct FindMinMaxCtx
659 uint32_t max; 663 uint32_t max;
660}; 664};
661 665
662
663static int 666static int
664find_min_max_it (void *cls, 667find_min_max_it (void *cls, const struct GNUNET_PeerIdentity *h, void *k)
665 const struct GNUNET_PeerIdentity *h,
666 void *k)
667{ 668{
668 struct FindMinMaxCtx *find_res = cls; 669 struct FindMinMaxCtx *find_res = cls;
669 struct ATS_Address *a = k; 670 struct ATS_Address *a = k;
@@ -677,11 +678,8 @@ find_min_max_it (void *cls,
677 return GNUNET_OK; 678 return GNUNET_OK;
678} 679}
679 680
680
681static int 681static int
682normalize_address (void *cls, 682normalize_address (void *cls, const struct GNUNET_PeerIdentity *h, void *k)
683 const struct GNUNET_PeerIdentity *h,
684 void *k)
685{ 683{
686 struct Property *p = cls; 684 struct Property *p = cls;
687 struct ATS_Address *address = k; 685 struct ATS_Address *address = k;
@@ -706,7 +704,6 @@ normalize_address (void *cls,
706 return GNUNET_OK; 704 return GNUNET_OK;
707} 705}
708 706
709
710/** 707/**
711 * Normalize avg_value to a range of values between [1.0, 2.0] 708 * Normalize avg_value to a range of values between [1.0, 2.0]
712 * based on min max values currently known. 709 * based on min max values currently known.
@@ -718,9 +715,7 @@ normalize_address (void *cls,
718 */ 715 */
719static void 716static void
720property_normalize (struct GNUNET_CONTAINER_MultiPeerMap *addresses, 717property_normalize (struct GNUNET_CONTAINER_MultiPeerMap *addresses,
721 struct Property *p, 718 struct Property *p, struct ATS_Address *address, uint32_t avg_value)
722 struct ATS_Address *address,
723 uint32_t avg_value)
724{ 719{
725 struct FindMinMaxCtx find_ctx; 720 struct FindMinMaxCtx find_ctx;
726 int addr_count; 721 int addr_count;
@@ -730,7 +725,7 @@ property_normalize (struct GNUNET_CONTAINER_MultiPeerMap *addresses,
730 find_ctx.max = 0; 725 find_ctx.max = 0;
731 find_ctx.min = UINT32_MAX; 726 find_ctx.min = UINT32_MAX;
732 addr_count = GNUNET_CONTAINER_multipeermap_iterate (addresses, 727 addr_count = GNUNET_CONTAINER_multipeermap_iterate (addresses,
733 &find_min_max_it, &find_ctx); 728 &find_min_max_it, &find_ctx);
734 if (0 == addr_count) 729 if (0 == addr_count)
735 { 730 {
736 GNUNET_break(0); 731 GNUNET_break(0);
@@ -786,10 +781,10 @@ property_normalize (struct GNUNET_CONTAINER_MultiPeerMap *addresses,
786 * @param atsi_count the number of atsi information in the array 781 * @param atsi_count the number of atsi information in the array
787 */ 782 */
788void 783void
789GAS_normalization_normalize_property (struct GNUNET_CONTAINER_MultiPeerMap *addresses, 784GAS_normalization_normalize_property (
790 struct ATS_Address *address, 785 struct GNUNET_CONTAINER_MultiPeerMap *addresses,
791 const struct GNUNET_ATS_Information *atsi, 786 struct ATS_Address *address, const struct GNUNET_ATS_Information *atsi,
792 uint32_t atsi_count) 787 uint32_t atsi_count)
793{ 788{
794 struct Property *cur_prop; 789 struct Property *cur_prop;
795 int c1; 790 int c1;
@@ -834,7 +829,6 @@ GAS_normalization_normalize_property (struct GNUNET_CONTAINER_MultiPeerMap *addr
834 } 829 }
835} 830}
836 831
837
838static void 832static void
839free_client (struct PreferenceClient *pc) 833free_client (struct PreferenceClient *pc)
840{ 834{
@@ -850,7 +844,6 @@ free_client (struct PreferenceClient *pc)
850 GNUNET_free(pc); 844 GNUNET_free(pc);
851} 845}
852 846
853
854/** 847/**
855 * A performance client disconnected 848 * A performance client disconnected
856 * 849 *
@@ -871,11 +864,10 @@ GAS_normalization_preference_client_disconnect (void *client)
871 if (NULL == c_cur) 864 if (NULL == c_cur)
872 return; 865 return;
873 866
874 GNUNET_CONTAINER_DLL_remove (pc_head, pc_tail, c_cur); 867 GNUNET_CONTAINER_DLL_remove(pc_head, pc_tail, c_cur);
875 free_client (c_cur); 868 free_client (c_cur);
876} 869}
877 870
878
879/** 871/**
880 * Start the normalization component 872 * Start the normalization component
881 * 873 *
@@ -917,7 +909,6 @@ GAS_normalization_start (GAS_Normalization_preference_changed_cb pref_ch_cb,
917 return; 909 return;
918} 910}
919 911
920
921/** 912/**
922 * Free a peer 913 * Free a peer
923 * 914 *
diff --git a/src/ats/gnunet-service-ats_normalization.h b/src/ats/gnunet-service-ats_normalization.h
index e1f5a5345..675d1fdf7 100644
--- a/src/ats/gnunet-service-ats_normalization.h
+++ b/src/ats/gnunet-service-ats_normalization.h
@@ -71,15 +71,15 @@ GAS_normalization_get_properties (struct ATS_Address *address);
71 71
72 72
73/** 73/**
74 * Get the normalized preference values for a specific client 74 * Get the normalized preference values for a specific client and peer
75 * 75 *
76 * @param client the client 76 * @param id the peer
77 * @param pref desired pref value 77 * @param the peer
78 * @return normalized value 78 * @return the value
79 */ 79 */
80const double 80const double
81GAS_normalization_get_preferences_by_client (const void *client, 81GAS_normalization_get_preferences_by_client (const void *client,
82 enum GNUNET_ATS_PreferenceKind pref); 82 struct GNUNET_PeerIdentity *peer, enum GNUNET_ATS_PreferenceKind pref);
83 83
84/** 84/**
85 * Normalize an updated preference value 85 * Normalize an updated preference value
diff --git a/src/ats/test_ats_solver_preferences.c b/src/ats/test_ats_solver_preferences.c
index 0e96dc129..0c7076ded 100644
--- a/src/ats/test_ats_solver_preferences.c
+++ b/src/ats/test_ats_solver_preferences.c
@@ -83,7 +83,7 @@ static void *test_session;
83/** 83/**
84 * Test ats info 84 * Test ats info
85 */ 85 */
86struct GNUNET_ATS_Information test_ats_info[2]; 86struct GNUNET_ATS_Information test_ats_info[3];
87 87
88/** 88/**
89 * Test ats count 89 * Test ats count
@@ -157,15 +157,13 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
157{ 157{
158 int c; 158 int c;
159 double pref_val; 159 double pref_val;
160 int prefs[GNUNET_ATS_PreferenceCount] = GNUNET_ATS_PreferenceType;
161
162 if (NULL == perf_ats) 160 if (NULL == perf_ats)
163 return; 161 return;
164 for (c = 1; c < GNUNET_ATS_PreferenceCount; c++) 162 for (c = 1; c < GNUNET_ATS_PreferenceCount; c++)
165 { 163 {
166 pref_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 10); 164 pref_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 10);
167 GNUNET_ATS_performance_change_preference (perf_ats, 165 GNUNET_ATS_performance_change_preference (perf_ats,
168 &test_hello_address.peer, prefs[c], pref_val, 166 &test_hello_address.peer, GNUNET_ATS_PREFERENCE_LATENCY, pref_val,
169 GNUNET_ATS_PREFERENCE_END); 167 GNUNET_ATS_PREFERENCE_END);
170 } 168 }
171} 169}
@@ -235,7 +233,9 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg,
235 test_ats_info[0].value = htonl (GNUNET_ATS_NET_WAN); 233 test_ats_info[0].value = htonl (GNUNET_ATS_NET_WAN);
236 test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); 234 test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
237 test_ats_info[1].value = htonl (1); 235 test_ats_info[1].value = htonl (1);
238 test_ats_count = 2; 236 test_ats_info[2].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
237 test_ats_info[2].value = htonl (100);
238 test_ats_count = 3;
239 239
240 /* Adding address without session */ 240 /* Adding address without session */
241 test_session = NULL; 241 test_session = NULL;