diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-04-03 09:24:29 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-04-03 09:24:29 +0000 |
commit | d1729a48969ffe8364f42f454af1f1c4e3b6ddb0 (patch) | |
tree | da5c9c255a8aa6ceae3f35b17ff0e00e041c3133 /src | |
parent | 48884c3a62a60679a0c8a6c422b6c73a282f759f (diff) | |
download | gnunet-d1729a48969ffe8364f42f454af1f1c4e3b6ddb0.tar.gz gnunet-d1729a48969ffe8364f42f454af1f1c4e3b6ddb0.zip |
api change, fix and improvements
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 50 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.h | 9 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses_mlp.c | 7 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses_mlp.h | 8 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses_simplistic.c | 20 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses_simplistic.h | 8 | ||||
-rw-r--r-- | src/ats/perf_ats_mlp.c | 2 | ||||
-rw-r--r-- | src/ats/test_ats_api_scheduling_update_address.c | 16 | ||||
-rw-r--r-- | src/ats/test_ats_mlp.c | 6 | ||||
-rw-r--r-- | src/ats/test_ats_mlp_update.c | 2 |
10 files changed, 85 insertions, 43 deletions
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index 921e93515..587147ec9 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -397,17 +397,21 @@ disassemble_ats_information (const struct GNUNET_ATS_Information *src, | |||
397 | change = GNUNET_NO; | 397 | change = GNUNET_NO; |
398 | add_atsi_count = 0; | 398 | add_atsi_count = 0; |
399 | 399 | ||
400 | if (0 == ats_count) | ||
401 | return GNUNET_NO; | ||
402 | |||
400 | if (NULL == dest->atsi) | 403 | if (NULL == dest->atsi) |
401 | { | 404 | { |
405 | /* Create performance information */ | ||
402 | dest->atsi = GNUNET_malloc (ats_count * sizeof (struct GNUNET_ATS_Information)); | 406 | dest->atsi = GNUNET_malloc (ats_count * sizeof (struct GNUNET_ATS_Information)); |
403 | dest->atsi_count = ats_count; | 407 | dest->atsi_count = ats_count; |
404 | memcpy (dest->atsi, src, ats_count * sizeof (struct GNUNET_ATS_Information)); | 408 | memcpy (dest->atsi, src, ats_count * sizeof (struct GNUNET_ATS_Information)); |
405 | return GNUNET_YES; | 409 | return GNUNET_YES; |
406 | } | 410 | } |
407 | 411 | ||
408 | /* Update existing performance information */ | ||
409 | for (c1 = 0; c1 < ats_count; c1++) | 412 | for (c1 = 0; c1 < ats_count; c1++) |
410 | { | 413 | { |
414 | /* Update existing performance information */ | ||
411 | found = GNUNET_NO; | 415 | found = GNUNET_NO; |
412 | for (c2 = 0; c2 < dest->atsi_count; c2++) | 416 | for (c2 = 0; c2 < dest->atsi_count; c2++) |
413 | { | 417 | { |
@@ -431,10 +435,14 @@ disassemble_ats_information (const struct GNUNET_ATS_Information *src, | |||
431 | 435 | ||
432 | if (add_atsi_count > 0) | 436 | if (add_atsi_count > 0) |
433 | { | 437 | { |
438 | /* Extend ats performance information */ | ||
434 | tmp_atsi = GNUNET_malloc ((dest->atsi_count + add_atsi_count) * | 439 | tmp_atsi = GNUNET_malloc ((dest->atsi_count + add_atsi_count) * |
435 | sizeof (sizeof (struct GNUNET_ATS_Information))); | 440 | sizeof (sizeof (struct GNUNET_ATS_Information))); |
436 | memcpy (tmp_atsi, dest->atsi, dest->atsi_count * sizeof (struct GNUNET_ATS_Information)); | 441 | memcpy (tmp_atsi, dest->atsi, dest->atsi_count * sizeof (struct GNUNET_ATS_Information)); |
437 | memcpy (&tmp_atsi[dest->atsi_count], add_atsi, add_atsi_count * sizeof (struct GNUNET_ATS_Information)); | 442 | memcpy (&tmp_atsi[dest->atsi_count], add_atsi, add_atsi_count * sizeof (struct GNUNET_ATS_Information)); |
443 | GNUNET_free (dest->atsi); | ||
444 | dest->atsi = tmp_atsi; | ||
445 | dest->atsi_count = dest->atsi_count + add_atsi_count; | ||
438 | change = GNUNET_YES; | 446 | change = GNUNET_YES; |
439 | } | 447 | } |
440 | 448 | ||
@@ -673,6 +681,29 @@ lookup_address (struct GAS_Addresses_Handle *handle, | |||
673 | return ea; | 681 | return ea; |
674 | } | 682 | } |
675 | 683 | ||
684 | /** | ||
685 | * Extract an ATS performance info from an address | ||
686 | * | ||
687 | * @param address the address | ||
688 | * @param type the type to extract in HBO | ||
689 | * @return the value in HBO or UINT32_MAX in HBO if value does not exist | ||
690 | */ | ||
691 | static int | ||
692 | get_performance_info (struct ATS_Address *address, uint32_t type) | ||
693 | { | ||
694 | int c1; | ||
695 | GNUNET_assert (NULL != address); | ||
696 | |||
697 | if ((NULL == address->atsi) || (0 == address->atsi_count)) | ||
698 | return UINT32_MAX; | ||
699 | |||
700 | for (c1 = 0; c1 < address->atsi_count; c1++) | ||
701 | { | ||
702 | if (ntohl(address->atsi[c1].type) == type) | ||
703 | return ntohl(address->atsi[c1].value); | ||
704 | } | ||
705 | return UINT32_MAX; | ||
706 | } | ||
676 | 707 | ||
677 | 708 | ||
678 | /** | 709 | /** |
@@ -697,7 +728,7 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle, | |||
697 | { | 728 | { |
698 | struct ATS_Address *aa; | 729 | struct ATS_Address *aa; |
699 | struct ATS_Address *ea; | 730 | struct ATS_Address *ea; |
700 | unsigned int ats_res; | 731 | uint32_t addr_net; |
701 | 732 | ||
702 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 733 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
703 | "Received `%s' for peer `%s'\n", | 734 | "Received `%s' for peer `%s'\n", |
@@ -711,13 +742,7 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle, | |||
711 | 742 | ||
712 | aa = create_address (peer, plugin_name, plugin_addr, plugin_addr_len, | 743 | aa = create_address (peer, plugin_name, plugin_addr, plugin_addr_len, |
713 | session_id); | 744 | session_id); |
714 | 745 | disassemble_ats_information (atsi, atsi_count, aa); | |
715 | if (atsi_count != (ats_res = disassemble_ats_information(atsi, atsi_count, aa))) | ||
716 | { | ||
717 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
718 | "While adding address: had %u ATS elements to add, could only add %u\n", | ||
719 | atsi_count, ats_res); | ||
720 | } | ||
721 | 746 | ||
722 | /* Get existing address or address with session == 0 */ | 747 | /* Get existing address or address with session == 0 */ |
723 | ea = find_equivalent_address (handle, peer, aa); | 748 | ea = find_equivalent_address (handle, peer, aa); |
@@ -730,8 +755,11 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle, | |||
730 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); | 755 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); |
731 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Added new address for peer `%s' session id %u, %p\n", | 756 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Added new address for peer `%s' session id %u, %p\n", |
732 | GNUNET_i2s (peer), session_id, aa); | 757 | GNUNET_i2s (peer), session_id, aa); |
758 | addr_net = get_performance_info (aa, GNUNET_ATS_NETWORK_TYPE); | ||
759 | if (UINT32_MAX == addr_net) | ||
760 | addr_net = GNUNET_ATS_NET_UNSPECIFIED; | ||
733 | /* Tell solver about new address */ | 761 | /* Tell solver about new address */ |
734 | handle->s_add (handle->solver, handle->addresses, aa); | 762 | handle->s_add (handle->solver, handle->addresses, aa, addr_net); |
735 | /* Notify performance clients about new address */ | 763 | /* Notify performance clients about new address */ |
736 | GAS_performance_notify_all_clients (&aa->peer, | 764 | GAS_performance_notify_all_clients (&aa->peer, |
737 | aa->plugin, | 765 | aa->plugin, |
@@ -742,7 +770,9 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle, | |||
742 | aa->assigned_bw_in); | 770 | aa->assigned_bw_in); |
743 | return; | 771 | return; |
744 | } | 772 | } |
773 | |||
745 | GNUNET_free (aa->plugin); | 774 | GNUNET_free (aa->plugin); |
775 | GNUNET_free_non_null (aa->atsi); | ||
746 | GNUNET_free (aa); | 776 | GNUNET_free (aa); |
747 | 777 | ||
748 | if (ea->session_id != 0) | 778 | if (ea->session_id != 0) |
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h index 25622a3a4..2a2a5dc1e 100644 --- a/src/ats/gnunet-service-ats_addresses.h +++ b/src/ats/gnunet-service-ats_addresses.h | |||
@@ -408,17 +408,20 @@ typedef void | |||
408 | enum GNUNET_ATS_PreferenceKind kind, | 408 | enum GNUNET_ATS_PreferenceKind kind, |
409 | float score); | 409 | float score); |
410 | 410 | ||
411 | |||
411 | /** | 412 | /** |
412 | * Add a single address to the solver | 413 | * Add a single address within a network to the solver |
413 | * | 414 | * |
414 | * @param solver the solver Handle | 415 | * @param solver the solver Handle |
415 | * @param addresses the address hashmap containing all addresses | 416 | * @param addresses the address hashmap containing all addresses |
416 | * @param address the address to add | 417 | * @param address the address to add |
418 | * @param network network type of this address | ||
417 | */ | 419 | */ |
418 | typedef void | 420 | typedef void |
419 | (*GAS_solver_address_add) (void *solver, | 421 | (*GAS_solver_address_add) (void *solver, |
420 | struct GNUNET_CONTAINER_MultiHashMap * addresses, | 422 | struct GNUNET_CONTAINER_MultiHashMap *addresses, |
421 | struct ATS_Address *address); | 423 | struct ATS_Address *address, |
424 | uint32_t network); | ||
422 | 425 | ||
423 | 426 | ||
424 | /** | 427 | /** |
diff --git a/src/ats/gnunet-service-ats_addresses_mlp.c b/src/ats/gnunet-service-ats_addresses_mlp.c index bc5ed5f32..e9c0cec07 100644 --- a/src/ats/gnunet-service-ats_addresses_mlp.c +++ b/src/ats/gnunet-service-ats_addresses_mlp.c | |||
@@ -1040,10 +1040,13 @@ GAS_mlp_solve_problem (void *solver, struct GNUNET_CONTAINER_MultiHashMap * addr | |||
1040 | * | 1040 | * |
1041 | * @param solver the solver Handle | 1041 | * @param solver the solver Handle |
1042 | * @param addresses the address hashmap containing all addresses | 1042 | * @param addresses the address hashmap containing all addresses |
1043 | * @param address the address to add | 1043 | * @param network network type of this address |
1044 | */ | 1044 | */ |
1045 | void | 1045 | void |
1046 | GAS_mlp_address_add (void *solver, struct GNUNET_CONTAINER_MultiHashMap * addresses, struct ATS_Address *address) | 1046 | GAS_mlp_address_add (void *solver, |
1047 | struct GNUNET_CONTAINER_MultiHashMap *addresses, | ||
1048 | struct ATS_Address *address, | ||
1049 | uint32_t network) | ||
1047 | { | 1050 | { |
1048 | struct GAS_MLP_Handle *mlp = solver; | 1051 | struct GAS_MLP_Handle *mlp = solver; |
1049 | struct ATS_Peer *p; | 1052 | struct ATS_Peer *p; |
diff --git a/src/ats/gnunet-service-ats_addresses_mlp.h b/src/ats/gnunet-service-ats_addresses_mlp.h index 81b8a4d0a..446fac3e9 100644 --- a/src/ats/gnunet-service-ats_addresses_mlp.h +++ b/src/ats/gnunet-service-ats_addresses_mlp.h | |||
@@ -363,14 +363,18 @@ GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
363 | 363 | ||
364 | 364 | ||
365 | /** | 365 | /** |
366 | * Add a single address to the solve | 366 | * Add a single address within a network to the solver |
367 | * | 367 | * |
368 | * @param solver the solver Handle | 368 | * @param solver the solver Handle |
369 | * @param addresses the address hashmap containing all addresses | 369 | * @param addresses the address hashmap containing all addresses |
370 | * @param address the address to add | 370 | * @param address the address to add |
371 | * @param network network type of this address | ||
371 | */ | 372 | */ |
372 | void | 373 | void |
373 | GAS_mlp_address_add (void *solver, struct GNUNET_CONTAINER_MultiHashMap * addresses, struct ATS_Address *address); | 374 | GAS_mlp_address_add (void *solver, |
375 | struct GNUNET_CONTAINER_MultiHashMap *addresses, | ||
376 | struct ATS_Address *address, | ||
377 | uint32_t network); | ||
374 | 378 | ||
375 | /** | 379 | /** |
376 | * Updates a single address in the MLP problem | 380 | * Updates a single address in the MLP problem |
diff --git a/src/ats/gnunet-service-ats_addresses_simplistic.c b/src/ats/gnunet-service-ats_addresses_simplistic.c index 8ce028c12..c773eaa0c 100644 --- a/src/ats/gnunet-service-ats_addresses_simplistic.c +++ b/src/ats/gnunet-service-ats_addresses_simplistic.c | |||
@@ -791,31 +791,29 @@ get_performance_info (struct ATS_Address *address, uint32_t type) | |||
791 | 791 | ||
792 | 792 | ||
793 | /** | 793 | /** |
794 | * Add a single address to the solve | 794 | * Add a single address within a network to the solver |
795 | * | 795 | * |
796 | * @param solver the solver Handle | 796 | * @param solver the solver Handle |
797 | * @param addresses the address hashmap containing all addresses | 797 | * @param addresses the address hashmap containing all addresses |
798 | * @param address the address to add | 798 | * @param address the address to add |
799 | * @param network network type of this address | ||
799 | */ | 800 | */ |
800 | void | 801 | void |
801 | GAS_simplistic_address_add (void *solver, struct GNUNET_CONTAINER_MultiHashMap * addresses, struct ATS_Address *address) | 802 | GAS_simplistic_address_add (void *solver, |
803 | struct GNUNET_CONTAINER_MultiHashMap *addresses, | ||
804 | struct ATS_Address *address, | ||
805 | uint32_t network) | ||
802 | { | 806 | { |
803 | struct GAS_SIMPLISTIC_Handle *s = solver; | 807 | struct GAS_SIMPLISTIC_Handle *s = solver; |
804 | struct Network *net = NULL; | 808 | struct Network *net = NULL; |
805 | struct AddressWrapper *aw = NULL; | 809 | struct AddressWrapper *aw = NULL; |
806 | uint32_t addr_net; | ||
807 | |||
808 | GNUNET_assert (NULL != s); | ||
809 | int c; | 810 | int c; |
810 | 811 | ||
811 | addr_net = get_performance_info (address, GNUNET_ATS_NETWORK_TYPE); | 812 | GNUNET_assert (NULL != s); |
812 | if (UINT32_MAX == addr_net) | ||
813 | addr_net = GNUNET_ATS_NET_UNSPECIFIED; | ||
814 | |||
815 | for (c = 0; c < s->networks; c++) | 813 | for (c = 0; c < s->networks; c++) |
816 | { | 814 | { |
817 | net = &s->network_entries[c]; | 815 | net = &s->network_entries[c]; |
818 | if (addr_net == net->type) | 816 | if (network == net->type) |
819 | break; | 817 | break; |
820 | } | 818 | } |
821 | if (NULL == net) | 819 | if (NULL == net) |
@@ -1008,7 +1006,7 @@ GAS_simplistic_address_update (void *solver, | |||
1008 | address->solver_information = new_net; | 1006 | address->solver_information = new_net; |
1009 | 1007 | ||
1010 | /* Add to new network and update*/ | 1008 | /* Add to new network and update*/ |
1011 | GAS_simplistic_address_add (solver, addresses, address); | 1009 | GAS_simplistic_address_add (solver, addresses, address, value); |
1012 | if (GNUNET_YES == save_active) | 1010 | if (GNUNET_YES == save_active) |
1013 | { | 1011 | { |
1014 | /* check if bandwidth available in new network */ | 1012 | /* check if bandwidth available in new network */ |
diff --git a/src/ats/gnunet-service-ats_addresses_simplistic.h b/src/ats/gnunet-service-ats_addresses_simplistic.h index c50454191..a97351efa 100644 --- a/src/ats/gnunet-service-ats_addresses_simplistic.h +++ b/src/ats/gnunet-service-ats_addresses_simplistic.h | |||
@@ -80,14 +80,18 @@ void | |||
80 | GAS_simplistic_done (void * solver); | 80 | GAS_simplistic_done (void * solver); |
81 | 81 | ||
82 | /** | 82 | /** |
83 | * Add a single address to the solve | 83 | * Add a single address within a network to the solver |
84 | * | 84 | * |
85 | * @param solver the solver Handle | 85 | * @param solver the solver Handle |
86 | * @param addresses the address hashmap containing all addresses | 86 | * @param addresses the address hashmap containing all addresses |
87 | * @param address the address to add | 87 | * @param address the address to add |
88 | * @param network network type of this address | ||
88 | */ | 89 | */ |
89 | void | 90 | void |
90 | GAS_simplistic_address_add (void *solver, struct GNUNET_CONTAINER_MultiHashMap * addresses, struct ATS_Address *address); | 91 | GAS_simplistic_address_add (void *solver, |
92 | struct GNUNET_CONTAINER_MultiHashMap *addresses, | ||
93 | struct ATS_Address *address, | ||
94 | uint32_t network); | ||
91 | 95 | ||
92 | 96 | ||
93 | /** | 97 | /** |
diff --git a/src/ats/perf_ats_mlp.c b/src/ats/perf_ats_mlp.c index 0959cefff..f835fddf8 100644 --- a/src/ats/perf_ats_mlp.c +++ b/src/ats/perf_ats_mlp.c | |||
@@ -320,7 +320,7 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
320 | { | 320 | { |
321 | cur_addr = perf_create_address(cp, ca); | 321 | cur_addr = perf_create_address(cp, ca); |
322 | /* add address */ | 322 | /* add address */ |
323 | GAS_mlp_address_add (mlp, addresses, cur_addr); | 323 | GAS_mlp_address_add (mlp, addresses, cur_addr, GNUNET_ATS_NET_UNSPECIFIED); |
324 | address_initial_update (mlp, addresses, cur_addr); | 324 | address_initial_update (mlp, addresses, cur_addr); |
325 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding address for peer %u address %u: \n", cp, ca); | 325 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding address for peer %u address %u: \n", cp, ca); |
326 | } | 326 | } |
diff --git a/src/ats/test_ats_api_scheduling_update_address.c b/src/ats/test_ats_api_scheduling_update_address.c index 2f52d64ae..c29bcb170 100644 --- a/src/ats/test_ats_api_scheduling_update_address.c +++ b/src/ats/test_ats_api_scheduling_update_address.c | |||
@@ -128,7 +128,8 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
128 | return; | 128 | return; |
129 | } | 129 | } |
130 | 130 | ||
131 | if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) | 131 | if ((ats_count != test_ats_count) || |
132 | (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count))) | ||
132 | { | 133 | { |
133 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage 0: Callback with incorrect ats info \n"); | 134 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage 0: Callback with incorrect ats info \n"); |
134 | ret = 1; | 135 | ret = 1; |
@@ -141,10 +142,10 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
141 | test_ats_info[0].type = htonl (GNUNET_ATS_NETWORK_TYPE); | 142 | test_ats_info[0].type = htonl (GNUNET_ATS_NETWORK_TYPE); |
142 | test_ats_info[0].value = htonl(GNUNET_ATS_NET_WAN); | 143 | test_ats_info[0].value = htonl(GNUNET_ATS_NET_WAN); |
143 | test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); | 144 | test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); |
144 | test_ats_info[1].value = htonl(3); | 145 | test_ats_info[1].value = htonl(5); |
145 | test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); | 146 | test_ats_info[2].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); |
146 | test_ats_info[1].value = htonl(30); | 147 | test_ats_info[2].value = htonl(30); |
147 | test_ats_count = 2; | 148 | test_ats_count = 3; |
148 | 149 | ||
149 | GNUNET_ATS_address_update (sched_ats, &test_hello_address, test_session, test_ats_info, test_ats_count); | 150 | GNUNET_ATS_address_update (sched_ats, &test_hello_address, test_session, test_ats_info, test_ats_count); |
150 | 151 | ||
@@ -168,7 +169,8 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
168 | ret = 1; | 169 | ret = 1; |
169 | } | 170 | } |
170 | 171 | ||
171 | if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) | 172 | if ((ats_count != test_ats_count) || |
173 | (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count))) | ||
172 | { | 174 | { |
173 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage 1: Callback with incorrect ats info \n"); | 175 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage 1: Callback with incorrect ats info \n"); |
174 | ret = 1; | 176 | ret = 1; |
@@ -214,8 +216,6 @@ run (void *cls, | |||
214 | /* Prepare ATS Information */ | 216 | /* Prepare ATS Information */ |
215 | test_ats_info[0].type = htonl (GNUNET_ATS_NETWORK_TYPE); | 217 | test_ats_info[0].type = htonl (GNUNET_ATS_NETWORK_TYPE); |
216 | test_ats_info[0].value = htonl(GNUNET_ATS_NET_WAN); | 218 | test_ats_info[0].value = htonl(GNUNET_ATS_NET_WAN); |
217 | test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); | ||
218 | test_ats_info[1].value = htonl(1); | ||
219 | test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); | 219 | test_ats_info[1].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); |
220 | test_ats_info[1].value = htonl(10); | 220 | test_ats_info[1].value = htonl(10); |
221 | test_ats_count = 2; | 221 | test_ats_count = 2; |
diff --git a/src/ats/test_ats_mlp.c b/src/ats/test_ats_mlp.c index 7b7186977..21334e414 100644 --- a/src/ats/test_ats_mlp.c +++ b/src/ats/test_ats_mlp.c | |||
@@ -233,7 +233,7 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
233 | GNUNET_CONTAINER_multihashmap_put (addresses, &p[0].hashPubKey, address[0], | 233 | GNUNET_CONTAINER_multihashmap_put (addresses, &p[0].hashPubKey, address[0], |
234 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 234 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); |
235 | /* Adding address 0 */ | 235 | /* Adding address 0 */ |
236 | GAS_mlp_address_add (mlp, addresses, address[0]); | 236 | GAS_mlp_address_add (mlp, addresses, address[0], GNUNET_ATS_NET_UNSPECIFIED); |
237 | 237 | ||
238 | /* Create address 1 */ | 238 | /* Create address 1 */ |
239 | address[1] = create_address (&p[0], "test_plugin1", "test_addr1", strlen("test_addr1")+1, 0); | 239 | address[1] = create_address (&p[0], "test_plugin1", "test_addr1", strlen("test_addr1")+1, 0); |
@@ -246,7 +246,7 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
246 | GNUNET_CONTAINER_multihashmap_put (addresses, &p[0].hashPubKey, address[1], | 246 | GNUNET_CONTAINER_multihashmap_put (addresses, &p[0].hashPubKey, address[1], |
247 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 247 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); |
248 | /* Adding address 1*/ | 248 | /* Adding address 1*/ |
249 | GAS_mlp_address_add (mlp, addresses, address[1]); | 249 | GAS_mlp_address_add (mlp, addresses, address[1], GNUNET_ATS_NET_UNSPECIFIED); |
250 | 250 | ||
251 | 251 | ||
252 | /* Create address 3 */ | 252 | /* Create address 3 */ |
@@ -260,7 +260,7 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
260 | GNUNET_CONTAINER_multihashmap_put (addresses, &p[1].hashPubKey, address[2], | 260 | GNUNET_CONTAINER_multihashmap_put (addresses, &p[1].hashPubKey, address[2], |
261 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 261 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); |
262 | /* Adding address 3*/ | 262 | /* Adding address 3*/ |
263 | GAS_mlp_address_add (mlp, addresses, address[2]); | 263 | GAS_mlp_address_add (mlp, addresses, address[2], GNUNET_ATS_NET_UNSPECIFIED); |
264 | 264 | ||
265 | 265 | ||
266 | /* Updating address 0*/ | 266 | /* Updating address 0*/ |
diff --git a/src/ats/test_ats_mlp_update.c b/src/ats/test_ats_mlp_update.c index ed48337e5..6f1bf7005 100644 --- a/src/ats/test_ats_mlp_update.c +++ b/src/ats/test_ats_mlp_update.c | |||
@@ -220,7 +220,7 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
220 | GNUNET_CONTAINER_multihashmap_put (addresses, &p[0].hashPubKey, address[0], | 220 | GNUNET_CONTAINER_multihashmap_put (addresses, &p[0].hashPubKey, address[0], |
221 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 221 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); |
222 | /* Adding address 0 */ | 222 | /* Adding address 0 */ |
223 | GAS_mlp_address_add (mlp, addresses, address[0]); | 223 | GAS_mlp_address_add (mlp, addresses, address[0], GNUNET_ATS_NET_UNSPECIFIED); |
224 | 224 | ||
225 | /* Retrieving preferred address for peer and wait for callback */ | 225 | /* Retrieving preferred address for peer and wait for callback */ |
226 | GAS_mlp_get_preferred_address (mlp, addresses, &p[0]); | 226 | GAS_mlp_get_preferred_address (mlp, addresses, &p[0]); |