diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-07-17 09:47:51 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-07-17 09:47:51 +0000 |
commit | 615d5aef87f985e4c489fac6c6d6232d35f8b0c2 (patch) | |
tree | 82eb29b40821ee0a5405737ac2d9f0428c6c2619 /src/ats | |
parent | 6053799e5d05b8d5c6c664b66e48f367b3dd6578 (diff) | |
download | gnunet-615d5aef87f985e4c489fac6c6d6232d35f8b0c2.tar.gz gnunet-615d5aef87f985e4c489fac6c6d6232d35f8b0c2.zip |
do not use NBO internally
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.c | 61 | ||||
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.h | 8 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 111 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.h | 31 | ||||
-rw-r--r-- | src/ats/perf_ats_solver.c | 7 | ||||
-rw-r--r-- | src/ats/plugin_ats_mlp.c | 45 | ||||
-rw-r--r-- | src/ats/plugin_ats_proportional.c | 67 | ||||
-rw-r--r-- | src/ats/plugin_ats_ril.c | 30 | ||||
-rw-r--r-- | src/ats/test_ats_api_common.c | 4 |
9 files changed, 187 insertions, 177 deletions
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index dd1bb9275..d21529f22 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c | |||
@@ -232,8 +232,8 @@ GNUNET_ATS_solver_logging_now (struct LoggingHandle *l) | |||
232 | log_a->prop_abs[c], log_a->prop_norm[c]); | 232 | log_a->prop_abs[c], log_a->prop_norm[c]); |
233 | } | 233 | } |
234 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t Active = %i\n", log_a->active); | 234 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t Active = %i\n", log_a->active); |
235 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t BW in = %llu\n", ntohl(log_a->assigned_bw_in.value__)); | 235 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t BW in = %llu\n", log_a->assigned_bw_in); |
236 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "\t BW out = %llu\n", ntohl(log_a->assigned_bw_out.value__)); | 236 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "\t BW out = %llu\n", log_a->assigned_bw_out); |
237 | 237 | ||
238 | GNUNET_CONTAINER_DLL_insert_tail (log_p->addr_head, log_p->addr_tail, log_a); | 238 | GNUNET_CONTAINER_DLL_insert_tail (log_p->addr_head, log_p->addr_tail, log_a); |
239 | } | 239 | } |
@@ -430,15 +430,12 @@ GNUNET_ATS_solver_logging_write_to_disk (struct LoggingHandle *l, int add_time_s | |||
430 | propstring = GNUNET_strdup(propstring_tmp); | 430 | propstring = GNUNET_strdup(propstring_tmp); |
431 | GNUNET_free (propstring_tmp); | 431 | GNUNET_free (propstring_tmp); |
432 | } | 432 | } |
433 | GNUNET_asprintf(&datastring,"%llu;%llu;%u;%u;%i;%u;%u;%s;%s\n", | 433 | GNUNET_asprintf (&datastring, "%llu;%llu;%u;%u;%i;%u;%u;%s;%s\n", |
434 | GNUNET_TIME_absolute_get_difference(l->head->timestamp, lts->timestamp).rel_value_us / 1000, | 434 | GNUNET_TIME_absolute_get_difference (l->head->timestamp, |
435 | lts->delta, | 435 | lts->timestamp).rel_value_us / 1000, lts->delta, |
436 | log_p->is_requested, | 436 | log_p->is_requested, log_a->network, log_a->active, |
437 | log_a->network, | 437 | log_a->assigned_bw_in, log_a->assigned_bw_out, propstring, |
438 | log_a->active, | 438 | prefstring); |
439 | ntohl (log_a->assigned_bw_in.value__), | ||
440 | ntohl (log_a->assigned_bw_out.value__), | ||
441 | propstring, prefstring); | ||
442 | 439 | ||
443 | GNUNET_DISK_file_write (cur->f_hd, datastring, strlen(datastring)); | 440 | GNUNET_DISK_file_write (cur->f_hd, datastring, strlen(datastring)); |
444 | GNUNET_free (datastring); | 441 | GNUNET_free (datastring); |
@@ -489,8 +486,8 @@ GNUNET_ATS_solver_logging_eval (struct LoggingHandle *l) | |||
489 | { | 486 | { |
490 | fprintf (stderr, "\tPeer pid %llu address %llu: %u %u %u\n", | 487 | fprintf (stderr, "\tPeer pid %llu address %llu: %u %u %u\n", |
491 | log_p->id, log_a->aid, log_a->active, | 488 | log_p->id, log_a->aid, log_a->active, |
492 | ntohl(log_a->assigned_bw_in.value__), | 489 | log_a->assigned_bw_in, |
493 | ntohl(log_a->assigned_bw_out.value__)); | 490 | log_a->assigned_bw_out); |
494 | 491 | ||
495 | for (c = 1; c < GNUNET_ATS_PropertyCount; c++) | 492 | for (c = 1; c < GNUNET_ATS_PropertyCount; c++) |
496 | { | 493 | { |
@@ -1139,8 +1136,8 @@ GNUNET_ATS_solver_generate_preferences_start (unsigned int peer, | |||
1139 | struct TestAddress * addr = find_active_address(p); | 1136 | struct TestAddress * addr = find_active_address(p); |
1140 | const double *properties = get_property_cb (NULL, addr->ats_addr); | 1137 | const double *properties = get_property_cb (NULL, addr->ats_addr); |
1141 | 1138 | ||
1142 | pg->last_assigned_bw_in = ntohl(p->assigned_bw_in.value__); | 1139 | pg->last_assigned_bw_in = p->assigned_bw_in; |
1143 | pg->last_assigned_bw_out = ntohl(p->assigned_bw_out.value__); | 1140 | pg->last_assigned_bw_out = p->assigned_bw_out; |
1144 | pg->feedback_bw_in_acc = 0; | 1141 | pg->feedback_bw_in_acc = 0; |
1145 | pg->feedback_bw_out_acc = 0; | 1142 | pg->feedback_bw_out_acc = 0; |
1146 | 1143 | ||
@@ -2178,8 +2175,8 @@ create_ats_address (const struct GNUNET_PeerIdentity *peer, | |||
2178 | aa->active = GNUNET_NO; | 2175 | aa->active = GNUNET_NO; |
2179 | aa->used = GNUNET_NO; | 2176 | aa->used = GNUNET_NO; |
2180 | aa->solver_information = NULL; | 2177 | aa->solver_information = NULL; |
2181 | aa->assigned_bw_in = GNUNET_BANDWIDTH_value_init(0); | 2178 | aa->assigned_bw_in = 0; |
2182 | aa->assigned_bw_out = GNUNET_BANDWIDTH_value_init(0); | 2179 | aa->assigned_bw_out = 0; |
2183 | 2180 | ||
2184 | return aa; | 2181 | return aa; |
2185 | } | 2182 | } |
@@ -2197,8 +2194,8 @@ enforce_add_address (struct GNUNET_ATS_TEST_Operation *op) | |||
2197 | { | 2194 | { |
2198 | p = GNUNET_new (struct TestPeer); | 2195 | p = GNUNET_new (struct TestPeer); |
2199 | p->id = op->peer_id; | 2196 | p->id = op->peer_id; |
2200 | p->assigned_bw_in = GNUNET_BANDWIDTH_value_init(0); | 2197 | p->assigned_bw_in = 0; |
2201 | p->assigned_bw_out = GNUNET_BANDWIDTH_value_init(0); | 2198 | p->assigned_bw_out = 0; |
2202 | memset (&p->peer_id, op->peer_id, sizeof (p->peer_id)); | 2199 | memset (&p->peer_id, op->peer_id, sizeof (p->peer_id)); |
2203 | for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) | 2200 | for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) |
2204 | { | 2201 | { |
@@ -2421,8 +2418,8 @@ enforce_start_request (struct GNUNET_ATS_TEST_Operation *op) | |||
2421 | { | 2418 | { |
2422 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Suggested address for peer %u: %llu %llu\n", | 2419 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Suggested address for peer %u: %llu %llu\n", |
2423 | op->peer_id, | 2420 | op->peer_id, |
2424 | ntohl(res->assigned_bw_in.value__), | 2421 | res->assigned_bw_in, |
2425 | ntohl(res->assigned_bw_out.value__)); | 2422 | res->assigned_bw_out); |
2426 | if (NULL != l) | 2423 | if (NULL != l) |
2427 | GNUNET_ATS_solver_logging_now (l); | 2424 | GNUNET_ATS_solver_logging_now (l); |
2428 | } | 2425 | } |
@@ -2446,8 +2443,8 @@ enforce_stop_request (struct GNUNET_ATS_TEST_Operation *op) | |||
2446 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stop requesting address for peer %u\n", | 2443 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stop requesting address for peer %u\n", |
2447 | op->peer_id); | 2444 | op->peer_id); |
2448 | p->is_requested = GNUNET_NO; | 2445 | p->is_requested = GNUNET_NO; |
2449 | p->assigned_bw_in.value__ = htonl(0); | 2446 | p->assigned_bw_in = 0; |
2450 | p->assigned_bw_out.value__ = htonl(0); | 2447 | p->assigned_bw_out = 0; |
2451 | sh->env.sf.s_get_stop (sh->solver, &p->peer_id); | 2448 | sh->env.sf.s_get_stop (sh->solver, &p->peer_id); |
2452 | 2449 | ||
2453 | if (NULL != l) | 2450 | if (NULL != l) |
@@ -2952,8 +2949,7 @@ solver_bandwidth_changed_cb (void *cls, struct ATS_Address *address) | |||
2952 | struct TestPeer *p; | 2949 | struct TestPeer *p; |
2953 | static struct PreferenceGenerator *pg; | 2950 | static struct PreferenceGenerator *pg; |
2954 | uint32_t delta; | 2951 | uint32_t delta; |
2955 | if ( (0 == ntohl (address->assigned_bw_out.value__)) && | 2952 | if ( (0 == address->assigned_bw_out) && (0 == address->assigned_bw_in) ) |
2956 | (0 == ntohl (address->assigned_bw_in.value__)) ) | ||
2957 | { | 2953 | { |
2958 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 2954 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
2959 | "Solver notified to disconnect peer `%s'\n", | 2955 | "Solver notified to disconnect peer `%s'\n", |
@@ -2976,18 +2972,19 @@ solver_bandwidth_changed_cb (void *cls, struct ATS_Address *address) | |||
2976 | delta = duration.rel_value_us * pg->last_assigned_bw_in; | 2972 | delta = duration.rel_value_us * pg->last_assigned_bw_in; |
2977 | pg->feedback_bw_in_acc += delta; | 2973 | pg->feedback_bw_in_acc += delta; |
2978 | 2974 | ||
2979 | pg->last_assigned_bw_in = ntohl (address->assigned_bw_in.value__); | 2975 | pg->last_assigned_bw_in = address->assigned_bw_in; |
2980 | pg->last_assigned_bw_out = ntohl (address->assigned_bw_out.value__); | 2976 | pg->last_assigned_bw_out = address->assigned_bw_out; |
2981 | pg->feedback_last_bw_update = GNUNET_TIME_absolute_get(); | 2977 | pg->feedback_last_bw_update = GNUNET_TIME_absolute_get(); |
2982 | } | 2978 | } |
2983 | } | 2979 | } |
2984 | 2980 | ||
2985 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 2981 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
2986 | "Bandwidth changed addresses %s %p to %u Bps out / %u Bps in\n", | 2982 | "Bandwidth changed addresses %s %p to %u Bps out / %u Bps in\n", |
2987 | GNUNET_i2s (&address->peer), | 2983 | GNUNET_i2s (&address->peer), |
2988 | address, | 2984 | address, |
2989 | (unsigned int) ntohl (address->assigned_bw_out.value__), | 2985 | address->assigned_bw_out, |
2990 | (unsigned int) ntohl (address->assigned_bw_in.value__)); | 2986 | address->assigned_bw_in); |
2987 | |||
2991 | if (NULL != l) | 2988 | if (NULL != l) |
2992 | GNUNET_ATS_solver_logging_now (l); | 2989 | GNUNET_ATS_solver_logging_now (l); |
2993 | 2990 | ||
diff --git a/src/ats/gnunet-ats-solver-eval.h b/src/ats/gnunet-ats-solver-eval.h index 27b9e4f9d..9893dc9f1 100644 --- a/src/ats/gnunet-ats-solver-eval.h +++ b/src/ats/gnunet-ats-solver-eval.h | |||
@@ -137,8 +137,8 @@ struct LoggingAddress | |||
137 | int active; | 137 | int active; |
138 | int used; | 138 | int used; |
139 | uint32_t network; | 139 | uint32_t network; |
140 | struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_in; | 140 | uint32_t assigned_bw_in; |
141 | struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_out; | 141 | uint32_t assigned_bw_out; |
142 | 142 | ||
143 | double prop_abs[GNUNET_ATS_PropertyCount]; | 143 | double prop_abs[GNUNET_ATS_PropertyCount]; |
144 | double prop_norm[GNUNET_ATS_PropertyCount]; | 144 | double prop_norm[GNUNET_ATS_PropertyCount]; |
@@ -158,8 +158,8 @@ struct TestPeer | |||
158 | double pref_abs[GNUNET_ATS_PreferenceCount]; | 158 | double pref_abs[GNUNET_ATS_PreferenceCount]; |
159 | double pref_norm[GNUNET_ATS_PreferenceCount]; | 159 | double pref_norm[GNUNET_ATS_PreferenceCount]; |
160 | 160 | ||
161 | struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_in; | 161 | uint32_t assigned_bw_in; |
162 | struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_out; | 162 | uint32_t assigned_bw_out; |
163 | 163 | ||
164 | struct TestAddress *addr_head; | 164 | struct TestAddress *addr_head; |
165 | struct TestAddress *addr_tail; | 165 | struct TestAddress *addr_tail; |
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index 718925e68..357358c7c 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -505,6 +505,10 @@ create_address (const struct GNUNET_PeerIdentity *peer, | |||
505 | aa->plugin = GNUNET_strdup (plugin_name); | 505 | aa->plugin = GNUNET_strdup (plugin_name); |
506 | aa->session_id = session_id; | 506 | aa->session_id = session_id; |
507 | aa->local_address_info = local_address_info; | 507 | aa->local_address_info = local_address_info; |
508 | aa->assigned_bw_out = 0; | ||
509 | aa->assigned_bw_in = 0; | ||
510 | aa->last_notified_bw_out = 0; | ||
511 | aa->last_notified_bw_in = 0; | ||
508 | 512 | ||
509 | for (c1 = 0; c1 < GNUNET_ATS_QualityPropertiesCount; c1++) | 513 | for (c1 = 0; c1 < GNUNET_ATS_QualityPropertiesCount; c1++) |
510 | { | 514 | { |
@@ -830,15 +834,11 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle, | |||
830 | handle->env.sf.s_bulk_stop (handle->solver); | 834 | handle->env.sf.s_bulk_stop (handle->solver); |
831 | 835 | ||
832 | /* Notify performance clients about new address */ | 836 | /* Notify performance clients about new address */ |
833 | GAS_performance_notify_all_clients (&new_address->peer, | 837 | GAS_performance_notify_all_clients (&new_address->peer, new_address->plugin, |
834 | new_address->plugin, | 838 | new_address->addr, new_address->addr_len, new_address->active, |
835 | new_address->addr, | 839 | new_address->atsi, new_address->atsi_count, |
836 | new_address->addr_len, | 840 | GNUNET_BANDWIDTH_value_init (new_address->assigned_bw_out), |
837 | new_address->active, | 841 | GNUNET_BANDWIDTH_value_init (new_address->assigned_bw_in)); |
838 | new_address->atsi, | ||
839 | new_address->atsi_count, | ||
840 | new_address->assigned_bw_out, | ||
841 | new_address->assigned_bw_in); | ||
842 | return; | 842 | return; |
843 | } | 843 | } |
844 | 844 | ||
@@ -874,14 +874,11 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle, | |||
874 | { | 874 | { |
875 | /* Notify performance clients about properties */ | 875 | /* Notify performance clients about properties */ |
876 | GAS_performance_notify_all_clients (&existing_address->peer, | 876 | GAS_performance_notify_all_clients (&existing_address->peer, |
877 | existing_address->plugin, | 877 | existing_address->plugin, existing_address->addr, |
878 | existing_address->addr, | 878 | existing_address->addr_len, existing_address->active, |
879 | existing_address->addr_len, | 879 | existing_address->atsi, existing_address->atsi_count, |
880 | existing_address->active, | 880 | GNUNET_BANDWIDTH_value_init (existing_address->assigned_bw_out), |
881 | existing_address->atsi, | 881 | GNUNET_BANDWIDTH_value_init (existing_address->assigned_bw_in)); |
882 | existing_address->atsi_count, | ||
883 | existing_address->assigned_bw_out, | ||
884 | existing_address->assigned_bw_in); | ||
885 | 882 | ||
886 | for (c1 = 0; c1 < atsi_delta_count; c1++) | 883 | for (c1 = 0; c1 < atsi_delta_count; c1++) |
887 | { | 884 | { |
@@ -1010,15 +1007,11 @@ GAS_addresses_update (struct GAS_Addresses_Handle *handle, | |||
1010 | } | 1007 | } |
1011 | 1008 | ||
1012 | /* Notify performance clients about updated address */ | 1009 | /* Notify performance clients about updated address */ |
1013 | GAS_performance_notify_all_clients (&aa->peer, | 1010 | GAS_performance_notify_all_clients (&aa->peer, aa->plugin, aa->addr, |
1014 | aa->plugin, | 1011 | aa->addr_len, aa->active, aa->atsi, aa->atsi_count, |
1015 | aa->addr, | 1012 | GNUNET_BANDWIDTH_value_init (aa->assigned_bw_out), |
1016 | aa->addr_len, | 1013 | GNUNET_BANDWIDTH_value_init (aa->assigned_bw_in)); |
1017 | aa->active, | 1014 | |
1018 | aa->atsi, | ||
1019 | aa->atsi_count, | ||
1020 | aa->assigned_bw_out, | ||
1021 | aa->assigned_bw_in); | ||
1022 | handle->env.sf.s_bulk_start (handle->solver); | 1015 | handle->env.sf.s_bulk_start (handle->solver); |
1023 | GAS_normalization_normalize_property (handle->addresses, | 1016 | GAS_normalization_normalize_property (handle->addresses, |
1024 | aa, | 1017 | aa, |
@@ -1405,9 +1398,9 @@ GAS_addresses_request_address (struct GAS_Addresses_Handle *handle, | |||
1405 | aa, GNUNET_i2s (peer)); | 1398 | aa, GNUNET_i2s (peer)); |
1406 | 1399 | ||
1407 | GAS_scheduling_transmit_address_suggestion (peer, aa->plugin, aa->addr, | 1400 | GAS_scheduling_transmit_address_suggestion (peer, aa->plugin, aa->addr, |
1408 | aa->addr_len, aa->local_address_info, aa->session_id, | 1401 | aa->addr_len, aa->local_address_info, aa->session_id, aa->atsi, |
1409 | aa->atsi, aa->atsi_count, | 1402 | aa->atsi_count, GNUNET_BANDWIDTH_value_init (aa->assigned_bw_out), |
1410 | aa->assigned_bw_out, aa->assigned_bw_in); | 1403 | GNUNET_BANDWIDTH_value_init (aa->assigned_bw_in)); |
1411 | 1404 | ||
1412 | aa->block_interval = GNUNET_TIME_relative_add (aa->block_interval, | 1405 | aa->block_interval = GNUNET_TIME_relative_add (aa->block_interval, |
1413 | ATS_BLOCKING_DELTA); | 1406 | ATS_BLOCKING_DELTA); |
@@ -1865,8 +1858,7 @@ load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1865 | * @param address the address with changes | 1858 | * @param address the address with changes |
1866 | */ | 1859 | */ |
1867 | static void | 1860 | static void |
1868 | bandwidth_changed_cb (void *cls, | 1861 | bandwidth_changed_cb (void *cls, struct ATS_Address *address) |
1869 | struct ATS_Address *address) | ||
1870 | { | 1862 | { |
1871 | struct GAS_Addresses_Handle *handle = cls; | 1863 | struct GAS_Addresses_Handle *handle = cls; |
1872 | struct GAS_Addresses_Suggestion_Requests *cur; | 1864 | struct GAS_Addresses_Suggestion_Requests *cur; |
@@ -1878,15 +1870,12 @@ bandwidth_changed_cb (void *cls, | |||
1878 | GNUNET_i2s (&address->peer)); | 1870 | GNUNET_i2s (&address->peer)); |
1879 | 1871 | ||
1880 | /* Notify performance clients about changes to address */ | 1872 | /* Notify performance clients about changes to address */ |
1881 | GAS_performance_notify_all_clients (&address->peer, | 1873 | GAS_performance_notify_all_clients (&address->peer, address->plugin, |
1882 | address->plugin, | 1874 | address->addr, address->addr_len, address->active, address->atsi, |
1883 | address->addr, | 1875 | address->atsi_count, |
1884 | address->addr_len, | 1876 | GNUNET_BANDWIDTH_value_init (address->assigned_bw_out), |
1885 | address->active, | 1877 | GNUNET_BANDWIDTH_value_init (address->assigned_bw_in)); |
1886 | address->atsi, | 1878 | |
1887 | address->atsi_count, | ||
1888 | address->assigned_bw_out, | ||
1889 | address->assigned_bw_in); | ||
1890 | cur = handle->pending_requests_head; | 1879 | cur = handle->pending_requests_head; |
1891 | while (NULL != cur) | 1880 | while (NULL != cur) |
1892 | { | 1881 | { |
@@ -1902,27 +1891,42 @@ bandwidth_changed_cb (void *cls, | |||
1902 | return; | 1891 | return; |
1903 | } | 1892 | } |
1904 | 1893 | ||
1905 | if ((0 == ntohl (address->assigned_bw_in.value__)) | 1894 | if ((0 == address->assigned_bw_in) && (0 == address->assigned_bw_out)) |
1906 | && (0 == ntohl (address->assigned_bw_out.value__))) | ||
1907 | { | 1895 | { |
1908 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1896 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1909 | "Telling transport to disconnect peer `%s'\n", | 1897 | "Telling transport to disconnect peer `%s'\n", |
1910 | GNUNET_i2s (&address->peer)); | 1898 | GNUNET_i2s (&address->peer)); |
1899 | |||
1900 | /* *Notify scheduling clients about suggestion */ | ||
1901 | GAS_scheduling_transmit_address_suggestion (&address->peer, address->plugin, | ||
1902 | address->addr, address->addr_len, address->local_address_info, | ||
1903 | address->session_id, address->atsi, address->atsi_count, | ||
1904 | GNUNET_BANDWIDTH_value_init (0), | ||
1905 | GNUNET_BANDWIDTH_value_init (0)); | ||
1906 | |||
1907 | return; | ||
1908 | |||
1911 | } | 1909 | } |
1912 | else | 1910 | |
1913 | { | 1911 | /* Do bandwidth stability check */ |
1914 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 1912 | int diff = abs (address->assigned_bw_out - address->last_notified_bw_out); |
1915 | "Sending bandwidth update for peer `%s': %u %u\n", | 1913 | |
1916 | GNUNET_i2s (&address->peer), | 1914 | |
1917 | (unsigned int) ntohl (address->assigned_bw_out.value__), | 1915 | |
1918 | (unsigned int) ntohl (address->assigned_bw_out.value__)); | 1916 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
1919 | } | 1917 | "Sending bandwidth update for peer `%s': %u %u\n", |
1918 | GNUNET_i2s (&address->peer), address->assigned_bw_out, | ||
1919 | address->assigned_bw_out); | ||
1920 | 1920 | ||
1921 | /* *Notify scheduling clients about suggestion */ | 1921 | /* *Notify scheduling clients about suggestion */ |
1922 | GAS_scheduling_transmit_address_suggestion (&address->peer, address->plugin, | 1922 | GAS_scheduling_transmit_address_suggestion (&address->peer, address->plugin, |
1923 | address->addr, address->addr_len, address->local_address_info, | 1923 | address->addr, address->addr_len, address->local_address_info, |
1924 | address->session_id, address->atsi, | 1924 | address->session_id, address->atsi, address->atsi_count, |
1925 | address->atsi_count, address->assigned_bw_out, address->assigned_bw_in); | 1925 | GNUNET_BANDWIDTH_value_init (address->assigned_bw_out), |
1926 | GNUNET_BANDWIDTH_value_init (address->assigned_bw_in)); | ||
1927 | |||
1928 | address->last_notified_bw_out = address->assigned_bw_out; | ||
1929 | address->last_notified_bw_in = address->assigned_bw_in; | ||
1926 | } | 1930 | } |
1927 | 1931 | ||
1928 | 1932 | ||
@@ -2260,7 +2264,8 @@ peerinfo_it (void *cls, | |||
2260 | { | 2264 | { |
2261 | pi_ctx->it (pi_ctx->it_cls, &addr->peer, addr->plugin, addr->addr, | 2265 | pi_ctx->it (pi_ctx->it_cls, &addr->peer, addr->plugin, addr->addr, |
2262 | addr->addr_len, addr->active, addr->atsi, addr->atsi_count, | 2266 | addr->addr_len, addr->active, addr->atsi, addr->atsi_count, |
2263 | addr->assigned_bw_out, addr->assigned_bw_in); | 2267 | GNUNET_BANDWIDTH_value_init (addr->assigned_bw_out), |
2268 | GNUNET_BANDWIDTH_value_init (addr->assigned_bw_in)); | ||
2264 | } | 2269 | } |
2265 | return GNUNET_YES; | 2270 | return GNUNET_YES; |
2266 | } | 2271 | } |
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h index d6e8b0e10..a1f9e69d5 100644 --- a/src/ats/gnunet-service-ats_addresses.h +++ b/src/ats/gnunet-service-ats_addresses.h | |||
@@ -309,24 +309,24 @@ struct ATS_Address | |||
309 | struct GNUNET_PeerIdentity peer; | 309 | struct GNUNET_PeerIdentity peer; |
310 | 310 | ||
311 | /** | 311 | /** |
312 | * Session ID, can be 0 | 312 | * Address |
313 | */ | 313 | */ |
314 | uint32_t session_id; | 314 | const void *addr; |
315 | 315 | ||
316 | /** | 316 | /** |
317 | * FIXME | 317 | * Address length |
318 | */ | 318 | */ |
319 | uint32_t local_address_info; | 319 | size_t addr_len; |
320 | 320 | ||
321 | /** | 321 | /** |
322 | * Address | 322 | * Session ID, can be 0 |
323 | */ | 323 | */ |
324 | const void *addr; | 324 | uint32_t session_id; |
325 | 325 | ||
326 | /** | 326 | /** |
327 | * Address length | 327 | * Field to store local flags |
328 | */ | 328 | */ |
329 | size_t addr_len; | 329 | uint32_t local_address_info; |
330 | 330 | ||
331 | /** | 331 | /** |
332 | * Plugin name | 332 | * Plugin name |
@@ -349,14 +349,25 @@ struct ATS_Address | |||
349 | uint32_t atsi_count; | 349 | uint32_t atsi_count; |
350 | 350 | ||
351 | /** | 351 | /** |
352 | * Inbound bandwidth assigned by solver | ||
353 | */ | ||
354 | uint32_t assigned_bw_in; | ||
355 | |||
356 | /** | ||
357 | * Outbound bandwidth assigned by solver | ||
358 | */ | ||
359 | uint32_t assigned_bw_out; | ||
360 | |||
361 | /** | ||
352 | * Inbound bandwidth assigned by solver in NBO | 362 | * Inbound bandwidth assigned by solver in NBO |
353 | */ | 363 | */ |
354 | struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_in; | 364 | uint32_t last_notified_bw_in; |
355 | 365 | ||
356 | /** | 366 | /** |
357 | * Outbound bandwidth assigned by solver in NBO | 367 | * Outbound bandwidth assigned by solver in NBO |
358 | */ | 368 | */ |
359 | struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_out; | 369 | uint32_t last_notified_bw_out; |
370 | |||
360 | 371 | ||
361 | /** | 372 | /** |
362 | * Blocking interval | 373 | * Blocking interval |
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c index 4e1e68c23..6fbf547ac 100644 --- a/src/ats/perf_ats_solver.c +++ b/src/ats/perf_ats_solver.c | |||
@@ -393,16 +393,15 @@ static void | |||
393 | bandwidth_changed_cb (void *cls, | 393 | bandwidth_changed_cb (void *cls, |
394 | struct ATS_Address *address) | 394 | struct ATS_Address *address) |
395 | { | 395 | { |
396 | if ( (0 == ntohl (address->assigned_bw_out.value__)) && | 396 | if ( (0 == address->assigned_bw_out) && (0 == address->assigned_bw_in) ) |
397 | (0 == ntohl (address->assigned_bw_in.value__)) ) | ||
398 | return; | 397 | return; |
399 | 398 | ||
400 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 399 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
401 | "Bandwidth changed addresses %s %p to %u Bps out / %u Bps in\n", | 400 | "Bandwidth changed addresses %s %p to %u Bps out / %u Bps in\n", |
402 | GNUNET_i2s (&address->peer), | 401 | GNUNET_i2s (&address->peer), |
403 | address, | 402 | address, |
404 | (unsigned int) ntohl (address->assigned_bw_out.value__), | 403 | address->assigned_bw_out, |
405 | (unsigned int) ntohl (address->assigned_bw_in.value__)); | 404 | address->assigned_bw_in); |
406 | if (GNUNET_YES == ph.bulk_running) | 405 | if (GNUNET_YES == ph.bulk_running) |
407 | GNUNET_break (0); | 406 | GNUNET_break (0); |
408 | return; | 407 | return; |
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c index b911435df..4491de078 100644 --- a/src/ats/plugin_ats_mlp.c +++ b/src/ats/plugin_ats_mlp.c | |||
@@ -394,9 +394,11 @@ struct GAS_MLP_Handle | |||
394 | struct MLP_information | 394 | struct MLP_information |
395 | { | 395 | { |
396 | 396 | ||
397 | /* Bandwidth assigned */ | 397 | /* Bandwidth assigned outbound */ |
398 | struct GNUNET_BANDWIDTH_Value32NBO b_out; | 398 | uint32_t b_out; |
399 | struct GNUNET_BANDWIDTH_Value32NBO b_in; | 399 | |
400 | /* Bandwidth assigned inbound */ | ||
401 | uint32_t b_in; | ||
400 | 402 | ||
401 | /* Address selected */ | 403 | /* Address selected */ |
402 | int n; | 404 | int n; |
@@ -1465,10 +1467,10 @@ mlp_propagate_results (void *cls, | |||
1465 | LOG (GNUNET_ERROR_TYPE_DEBUG, "%s %.2f : enabling address\n", | 1467 | LOG (GNUNET_ERROR_TYPE_DEBUG, "%s %.2f : enabling address\n", |
1466 | (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); | 1468 | (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); |
1467 | address->active = GNUNET_YES; | 1469 | address->active = GNUNET_YES; |
1468 | address->assigned_bw_in.value__ = htonl (mlp_bw_in); | 1470 | address->assigned_bw_in = mlp_bw_in; |
1469 | mlpi->b_in.value__ = htonl(mlp_bw_in); | 1471 | mlpi->b_in = mlp_bw_in; |
1470 | address->assigned_bw_out.value__ = htonl (mlp_bw_out); | 1472 | address->assigned_bw_out = mlp_bw_out; |
1471 | mlpi->b_out.value__ = htonl(mlp_bw_out); | 1473 | mlpi->b_out = mlp_bw_out; |
1472 | if ((NULL == mlp->exclude_peer) || (0 != memcmp (&address->peer, mlp->exclude_peer, sizeof (address->peer)))) | 1474 | if ((NULL == mlp->exclude_peer) || (0 != memcmp (&address->peer, mlp->exclude_peer, sizeof (address->peer)))) |
1473 | mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address); | 1475 | mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address); |
1474 | return GNUNET_OK; | 1476 | return GNUNET_OK; |
@@ -1476,15 +1478,15 @@ mlp_propagate_results (void *cls, | |||
1476 | else if (GNUNET_YES == address->active) | 1478 | else if (GNUNET_YES == address->active) |
1477 | { | 1479 | { |
1478 | /* Address was used before, check for bandwidth change */ | 1480 | /* Address was used before, check for bandwidth change */ |
1479 | if ((mlp_bw_out != ntohl(address->assigned_bw_out.value__)) || | 1481 | if ((mlp_bw_out != address->assigned_bw_out) || |
1480 | (mlp_bw_in != ntohl(address->assigned_bw_in.value__))) | 1482 | (mlp_bw_in != address->assigned_bw_in)) |
1481 | { | 1483 | { |
1482 | LOG (GNUNET_ERROR_TYPE_DEBUG, "%s %.2f : bandwidth changed\n", | 1484 | LOG (GNUNET_ERROR_TYPE_DEBUG, "%s %.2f : bandwidth changed\n", |
1483 | (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); | 1485 | (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); |
1484 | address->assigned_bw_in.value__ = htonl (mlp_bw_in); | 1486 | address->assigned_bw_in = mlp_bw_in; |
1485 | mlpi->b_in.value__ = htonl(mlp_bw_in); | 1487 | mlpi->b_in = mlp_bw_in; |
1486 | address->assigned_bw_out.value__ = htonl (mlp_bw_out); | 1488 | address->assigned_bw_out = mlp_bw_out; |
1487 | mlpi->b_out.value__ = htonl(mlp_bw_out); | 1489 | mlpi->b_out = mlp_bw_out; |
1488 | if ((NULL == mlp->exclude_peer) || (0 != memcmp (&address->peer, mlp->exclude_peer, sizeof (address->peer)))) | 1490 | if ((NULL == mlp->exclude_peer) || (0 != memcmp (&address->peer, mlp->exclude_peer, sizeof (address->peer)))) |
1489 | mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address); | 1491 | mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address); |
1490 | return GNUNET_OK; | 1492 | return GNUNET_OK; |
@@ -1511,11 +1513,10 @@ mlp_propagate_results (void *cls, | |||
1511 | (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); | 1513 | (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); |
1512 | address->active = GNUNET_NO; | 1514 | address->active = GNUNET_NO; |
1513 | /* Set bandwidth to 0 */ | 1515 | /* Set bandwidth to 0 */ |
1514 | address->assigned_bw_in = BANDWIDTH_ZERO; | 1516 | address->assigned_bw_in = 0; |
1515 | mlpi->b_in.value__ = htonl(mlp_bw_in); | 1517 | mlpi->b_in = 0; |
1516 | address->assigned_bw_out = BANDWIDTH_ZERO; | 1518 | address->assigned_bw_out = 0; |
1517 | mlpi->b_out.value__ = htonl(mlp_bw_out); | 1519 | mlpi->b_out = 0; |
1518 | //mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address); | ||
1519 | return GNUNET_OK; | 1520 | return GNUNET_OK; |
1520 | } | 1521 | } |
1521 | else | 1522 | else |
@@ -2338,8 +2339,8 @@ GAS_mlp_address_delete (void *solver, | |||
2338 | } | 2339 | } |
2339 | was_active = address->active; | 2340 | was_active = address->active; |
2340 | address->active = GNUNET_NO; | 2341 | address->active = GNUNET_NO; |
2341 | address->assigned_bw_in = BANDWIDTH_ZERO; | 2342 | address->assigned_bw_in = 0; |
2342 | address->assigned_bw_out = BANDWIDTH_ZERO; | 2343 | address->assigned_bw_out = 0; |
2343 | 2344 | ||
2344 | /* Is this peer included in the problem? */ | 2345 | /* Is this peer included in the problem? */ |
2345 | if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, | 2346 | if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, |
@@ -2950,8 +2951,8 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2950 | 2951 | ||
2951 | if (GNUNET_NO == found) | 2952 | if (GNUNET_NO == found) |
2952 | { | 2953 | { |
2953 | mlp->pv.quota_in[c] = ntohl(GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__); | 2954 | mlp->pv.quota_in[c] = ntohl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__); |
2954 | mlp->pv.quota_out[c] = ntohl(GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__); | 2955 | mlp->pv.quota_out[c] = ntohl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__); |
2955 | LOG (GNUNET_ERROR_TYPE_INFO, _("Using default quota configuration for network `%s' (in/out) %llu/%llu\n"), | 2956 | LOG (GNUNET_ERROR_TYPE_INFO, _("Using default quota configuration for network `%s' (in/out) %llu/%llu\n"), |
2956 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | 2957 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), |
2957 | mlp->pv.quota_in[c], | 2958 | mlp->pv.quota_in[c], |
diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c index 139214118..5fc065cba 100644 --- a/src/ats/plugin_ats_proportional.c +++ b/src/ats/plugin_ats_proportional.c | |||
@@ -367,19 +367,22 @@ struct Network | |||
367 | */ | 367 | */ |
368 | struct AddressSolverInformation | 368 | struct AddressSolverInformation |
369 | { | 369 | { |
370 | /** | ||
371 | * Network scope this address is in | ||
372 | */ | ||
370 | struct Network *network; | 373 | struct Network *network; |
371 | 374 | ||
372 | /** | 375 | /** |
373 | * Inbound quota | 376 | * Inbound quota |
374 | * | 377 | * |
375 | */ | 378 | */ |
376 | unsigned long long calculated_quota_in_NBO; | 379 | uint32_t calculated_quota_in; |
377 | 380 | ||
378 | /** | 381 | /** |
379 | * Outbound quota | 382 | * Outbound quota |
380 | * | 383 | * |
381 | */ | 384 | */ |
382 | unsigned long long calculated_quota_out_NBO; | 385 | uint32_t calculated_quota_out; |
383 | 386 | ||
384 | /** | 387 | /** |
385 | * When was this address activated | 388 | * When was this address activated |
@@ -529,8 +532,8 @@ distribute_bandwidth (struct GAS_PROPORTIONAL_Handle *s, | |||
529 | double total_weight; | 532 | double total_weight; |
530 | const double *peer_relative_prefs = NULL; /* Important: has to be double not float due to precision */ | 533 | const double *peer_relative_prefs = NULL; /* Important: has to be double not float due to precision */ |
531 | 534 | ||
532 | unsigned long long assigned_quota_in = 0; | 535 | uint32_t assigned_quota_in = 0; |
533 | unsigned long long assigned_quota_out = 0; | 536 | uint32_t assigned_quota_out = 0; |
534 | 537 | ||
535 | 538 | ||
536 | LOG(GNUNET_ERROR_TYPE_INFO, | 539 | LOG(GNUNET_ERROR_TYPE_INFO, |
@@ -639,8 +642,8 @@ distribute_bandwidth (struct GAS_PROPORTIONAL_Handle *s, | |||
639 | 642 | ||
640 | /* Compare to current bandwidth assigned */ | 643 | /* Compare to current bandwidth assigned */ |
641 | asi = cur_address->addr->solver_information; | 644 | asi = cur_address->addr->solver_information; |
642 | asi->calculated_quota_in_NBO = htonl (assigned_quota_in); | 645 | asi->calculated_quota_in = assigned_quota_in; |
643 | asi->calculated_quota_out_NBO = htonl (assigned_quota_out); | 646 | asi->calculated_quota_out = assigned_quota_out; |
644 | } | 647 | } |
645 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 648 | LOG(GNUNET_ERROR_TYPE_DEBUG, |
646 | "Total bandwidth assigned is (in/out): %llu /%llu\n", quota_in_used, | 649 | "Total bandwidth assigned is (in/out): %llu /%llu\n", quota_in_used, |
@@ -1087,23 +1090,22 @@ propagate_bandwidth (struct GAS_PROPORTIONAL_Handle *s, | |||
1087 | for (cur = net->head; NULL != cur; cur = cur->next) | 1090 | for (cur = net->head; NULL != cur; cur = cur->next) |
1088 | { | 1091 | { |
1089 | asi = cur->addr->solver_information; | 1092 | asi = cur->addr->solver_information; |
1090 | if ( (cur->addr->assigned_bw_in.value__ != asi->calculated_quota_in_NBO) || | 1093 | if ( (cur->addr->assigned_bw_in != asi->calculated_quota_in) || |
1091 | (cur->addr->assigned_bw_out.value__ != asi->calculated_quota_out_NBO) ) | 1094 | (cur->addr->assigned_bw_out != asi->calculated_quota_out) ) |
1092 | { | 1095 | { |
1093 | cur->addr->assigned_bw_in.value__ = asi->calculated_quota_in_NBO; | 1096 | cur->addr->assigned_bw_in = asi->calculated_quota_in; |
1094 | cur->addr->assigned_bw_out.value__ = asi->calculated_quota_out_NBO; | 1097 | cur->addr->assigned_bw_out = asi->calculated_quota_out; |
1095 | 1098 | ||
1096 | /* Reset for next iteration */ | 1099 | /* Reset for next iteration */ |
1097 | asi->calculated_quota_in_NBO = htonl (0); | 1100 | asi->calculated_quota_in = 0; |
1098 | asi->calculated_quota_out_NBO = htonl (0); | 1101 | asi->calculated_quota_out = 0; |
1099 | |||
1100 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1102 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1101 | "Bandwidth for %s address %p for peer `%s' changed to %u/%u\n", | 1103 | "Bandwidth for %s address %p for peer `%s' changed to %u/%u\n", |
1102 | (GNUNET_NO == cur->addr->active) ? "inactive" : "active", | 1104 | (GNUNET_NO == cur->addr->active) ? "inactive" : "active", |
1103 | cur->addr, | 1105 | cur->addr, |
1104 | GNUNET_i2s (&cur->addr->peer), | 1106 | GNUNET_i2s (&cur->addr->peer), |
1105 | ntohl (cur->addr->assigned_bw_in.value__), | 1107 | cur->addr->assigned_bw_in, |
1106 | ntohl (cur->addr->assigned_bw_out.value__ )); | 1108 | cur->addr->assigned_bw_out); |
1107 | 1109 | ||
1108 | /* Notify on change */ | 1110 | /* Notify on change */ |
1109 | if ((GNUNET_YES == cur->addr->active)) | 1111 | if ((GNUNET_YES == cur->addr->active)) |
@@ -1215,17 +1217,12 @@ update_active_address (struct GAS_PROPORTIONAL_Handle *s, | |||
1215 | /* Find active address */ | 1217 | /* Find active address */ |
1216 | current_address = get_active_address (s, s->addresses, peer); | 1218 | current_address = get_active_address (s, s->addresses, peer); |
1217 | 1219 | ||
1218 | LOG (GNUNET_ERROR_TYPE_INFO, | 1220 | LOG (GNUNET_ERROR_TYPE_INFO, "Peer `%s' has active address %p\n", |
1219 | "Peer `%s' has active address %p\n", | 1221 | GNUNET_i2s (peer), current_address); |
1220 | GNUNET_i2s (peer), | ||
1221 | current_address); | ||
1222 | |||
1223 | 1222 | ||
1224 | /* Find best address */ | 1223 | /* Find best address */ |
1225 | best_address = get_best_address (s,s->addresses, peer); | 1224 | best_address = get_best_address (s,s->addresses, peer); |
1226 | 1225 | LOG (GNUNET_ERROR_TYPE_INFO, "Peer `%s' has best address %p\n", | |
1227 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
1228 | "Peer `%s' has best address %p\n", | ||
1229 | GNUNET_i2s (peer), best_address); | 1226 | GNUNET_i2s (peer), best_address); |
1230 | 1227 | ||
1231 | if (NULL != current_address) | 1228 | if (NULL != current_address) |
@@ -1246,8 +1243,8 @@ update_active_address (struct GAS_PROPORTIONAL_Handle *s, | |||
1246 | net = asi->network; | 1243 | net = asi->network; |
1247 | asi->activated = GNUNET_TIME_UNIT_ZERO_ABS; | 1244 | asi->activated = GNUNET_TIME_UNIT_ZERO_ABS; |
1248 | current_address->active = GNUNET_NO; /* No active any longer */ | 1245 | current_address->active = GNUNET_NO; /* No active any longer */ |
1249 | current_address->assigned_bw_in = BANDWIDTH_ZERO; /* no bandwidth assigned */ | 1246 | current_address->assigned_bw_in = 0; /* no bandwidth assigned */ |
1250 | current_address->assigned_bw_out = BANDWIDTH_ZERO; /* no bandwidth assigned */ | 1247 | current_address->assigned_bw_out = 0; /* no bandwidth assigned */ |
1251 | 1248 | ||
1252 | if (GNUNET_SYSERR == addresse_decrement (s, net, GNUNET_NO, GNUNET_YES)) | 1249 | if (GNUNET_SYSERR == addresse_decrement (s, net, GNUNET_NO, GNUNET_YES)) |
1253 | GNUNET_break(0); | 1250 | GNUNET_break(0); |
@@ -1442,8 +1439,8 @@ GAS_proportional_stop_get_preferred_address (void *solver, | |||
1442 | cur_net = asi->network ; | 1439 | cur_net = asi->network ; |
1443 | asi->activated = GNUNET_TIME_UNIT_ZERO_ABS; | 1440 | asi->activated = GNUNET_TIME_UNIT_ZERO_ABS; |
1444 | cur->active = GNUNET_NO; /* No active any longer */ | 1441 | cur->active = GNUNET_NO; /* No active any longer */ |
1445 | cur->assigned_bw_in = BANDWIDTH_ZERO; /* no bandwidth assigned */ | 1442 | cur->assigned_bw_in = 0; /* no bandwidth assigned */ |
1446 | cur->assigned_bw_out = BANDWIDTH_ZERO; /* no bandwidth assigned */ | 1443 | cur->assigned_bw_out = 0; /* no bandwidth assigned */ |
1447 | 1444 | ||
1448 | if (GNUNET_SYSERR == addresse_decrement (s, cur_net, GNUNET_NO, GNUNET_YES)) | 1445 | if (GNUNET_SYSERR == addresse_decrement (s, cur_net, GNUNET_NO, GNUNET_YES)) |
1449 | GNUNET_break(0); | 1446 | GNUNET_break(0); |
@@ -1525,10 +1522,10 @@ GAS_proportional_address_delete (void *solver, | |||
1525 | /* Address was active, remove from network and update quotas*/ | 1522 | /* Address was active, remove from network and update quotas*/ |
1526 | address->active = GNUNET_NO; | 1523 | address->active = GNUNET_NO; |
1527 | 1524 | ||
1528 | address->assigned_bw_in = BANDWIDTH_ZERO; | 1525 | address->assigned_bw_in = 0; |
1529 | address->assigned_bw_out = BANDWIDTH_ZERO; | 1526 | address->assigned_bw_out = 0; |
1530 | asi->calculated_quota_in_NBO = htonl (0); | 1527 | asi->calculated_quota_in = 0; |
1531 | asi->calculated_quota_out_NBO = htonl (0); | 1528 | asi->calculated_quota_out = 0; |
1532 | 1529 | ||
1533 | if (GNUNET_SYSERR == addresse_decrement (s, net, GNUNET_NO, GNUNET_YES)) | 1530 | if (GNUNET_SYSERR == addresse_decrement (s, net, GNUNET_NO, GNUNET_YES)) |
1534 | GNUNET_break(0); | 1531 | GNUNET_break(0); |
@@ -1837,8 +1834,8 @@ GAS_proportional_address_change_network (void *solver, | |||
1837 | 1834 | ||
1838 | /* Disable and assign no bandwidth */ | 1835 | /* Disable and assign no bandwidth */ |
1839 | address->active = GNUNET_NO; | 1836 | address->active = GNUNET_NO; |
1840 | address->assigned_bw_in = BANDWIDTH_ZERO; /* no bandwidth assigned */ | 1837 | address->assigned_bw_in = 0; /* no bandwidth assigned */ |
1841 | address->assigned_bw_out = BANDWIDTH_ZERO; /* no bandwidth assigned */ | 1838 | address->assigned_bw_out = 0; /* no bandwidth assigned */ |
1842 | 1839 | ||
1843 | /* Remove from old network */ | 1840 | /* Remove from old network */ |
1844 | GAS_proportional_address_delete (solver, address, GNUNET_NO); | 1841 | GAS_proportional_address_delete (solver, address, GNUNET_NO); |
@@ -1910,8 +1907,8 @@ GAS_proportional_address_add (void *solver, | |||
1910 | 1907 | ||
1911 | asi = GNUNET_new (struct AddressSolverInformation); | 1908 | asi = GNUNET_new (struct AddressSolverInformation); |
1912 | asi->network = net; | 1909 | asi->network = net; |
1913 | asi->calculated_quota_in_NBO = htonl (0); | 1910 | asi->calculated_quota_in = 0; |
1914 | asi->calculated_quota_out_NBO = htonl (0); | 1911 | asi->calculated_quota_out = 0; |
1915 | aw->addr->solver_information = asi; | 1912 | aw->addr->solver_information = asi; |
1916 | 1913 | ||
1917 | LOG(GNUNET_ERROR_TYPE_INFO, | 1914 | LOG(GNUNET_ERROR_TYPE_INFO, |
diff --git a/src/ats/plugin_ats_ril.c b/src/ats/plugin_ats_ril.c index 10650a5c4..4feb0fd9a 100644 --- a/src/ats/plugin_ats_ril.c +++ b/src/ats/plugin_ats_ril.c | |||
@@ -308,12 +308,12 @@ struct RIL_Peer_Agent | |||
308 | /** | 308 | /** |
309 | * Inbound bandwidth assigned by the agent | 309 | * Inbound bandwidth assigned by the agent |
310 | */ | 310 | */ |
311 | unsigned long long bw_in; | 311 | uint32_t bw_in; |
312 | 312 | ||
313 | /** | 313 | /** |
314 | * Outbound bandwidth assigned by the agent | 314 | * Outbound bandwidth assigned by the agent |
315 | */ | 315 | */ |
316 | unsigned long long bw_out; | 316 | uint32_t bw_out; |
317 | 317 | ||
318 | /** | 318 | /** |
319 | * Flag whether a suggestion has to be issued | 319 | * Flag whether a suggestion has to be issued |
@@ -346,22 +346,22 @@ struct RIL_Scope | |||
346 | /** | 346 | /** |
347 | * Total available inbound bandwidth | 347 | * Total available inbound bandwidth |
348 | */ | 348 | */ |
349 | unsigned long long bw_in_available; | 349 | uint32_t bw_in_available; |
350 | 350 | ||
351 | /** | 351 | /** |
352 | * Bandwidth inbound assigned in network after last step | 352 | * Bandwidth inbound assigned in network after last step |
353 | */ | 353 | */ |
354 | unsigned long long bw_in_assigned; | 354 | uint32_t bw_in_assigned; |
355 | 355 | ||
356 | /** | 356 | /** |
357 | * Bandwidth inbound actually utilized in the network | 357 | * Bandwidth inbound actually utilized in the network |
358 | */ | 358 | */ |
359 | unsigned long long bw_in_utilized; | 359 | uint32_t bw_in_utilized; |
360 | 360 | ||
361 | /** | 361 | /** |
362 | * Total available outbound bandwidth | 362 | * Total available outbound bandwidth |
363 | */ | 363 | */ |
364 | unsigned long long bw_out_available; | 364 | uint32_t bw_out_available; |
365 | 365 | ||
366 | /** | 366 | /** |
367 | * Bandwidth outbound assigned in network after last step | 367 | * Bandwidth outbound assigned in network after last step |
@@ -830,15 +830,15 @@ envi_set_active_suggestion (struct GAS_RIL_Handle *solver, | |||
830 | if (NULL != agent->address_inuse) | 830 | if (NULL != agent->address_inuse) |
831 | { | 831 | { |
832 | agent->address_inuse->active = GNUNET_NO; | 832 | agent->address_inuse->active = GNUNET_NO; |
833 | agent->address_inuse->assigned_bw_in.value__ = htonl (0); | 833 | agent->address_inuse->assigned_bw_in = 0; |
834 | agent->address_inuse->assigned_bw_out.value__ = htonl (0); | 834 | agent->address_inuse->assigned_bw_out = 0; |
835 | } | 835 | } |
836 | if (NULL != new_address) | 836 | if (NULL != new_address) |
837 | { | 837 | { |
838 | LOG(GNUNET_ERROR_TYPE_DEBUG, " set address active: %s\n", agent->is_active ? "yes" : "no"); | 838 | LOG(GNUNET_ERROR_TYPE_DEBUG, " set address active: %s\n", agent->is_active ? "yes" : "no"); |
839 | new_address->active = agent->is_active; | 839 | new_address->active = agent->is_active; |
840 | new_address->assigned_bw_in.value__ = htonl (agent->bw_in); | 840 | new_address->assigned_bw_in = agent->bw_in; |
841 | new_address->assigned_bw_out.value__ = htonl (agent->bw_out); | 841 | new_address->assigned_bw_out = agent->bw_out; |
842 | } | 842 | } |
843 | notify |= GNUNET_YES; | 843 | notify |= GNUNET_YES; |
844 | } | 844 | } |
@@ -856,13 +856,13 @@ envi_set_active_suggestion (struct GAS_RIL_Handle *solver, | |||
856 | if (agent->bw_in != new_bw_in) | 856 | if (agent->bw_in != new_bw_in) |
857 | { | 857 | { |
858 | agent->bw_in = new_bw_in; | 858 | agent->bw_in = new_bw_in; |
859 | new_address->assigned_bw_in.value__ = htonl (new_bw_in); | 859 | new_address->assigned_bw_in = new_bw_in; |
860 | notify |= GNUNET_YES; | 860 | notify |= GNUNET_YES; |
861 | } | 861 | } |
862 | if (agent->bw_out != new_bw_out) | 862 | if (agent->bw_out != new_bw_out) |
863 | { | 863 | { |
864 | agent->bw_out = new_bw_out; | 864 | agent->bw_out = new_bw_out; |
865 | new_address->assigned_bw_out.value__ = htonl (new_bw_out); | 865 | new_address->assigned_bw_out = new_bw_out; |
866 | notify |= GNUNET_YES; | 866 | notify |= GNUNET_YES; |
867 | } | 867 | } |
868 | } | 868 | } |
@@ -877,9 +877,9 @@ envi_set_active_suggestion (struct GAS_RIL_Handle *solver, | |||
877 | } | 877 | } |
878 | else if (agent->address_inuse) | 878 | else if (agent->address_inuse) |
879 | { | 879 | { |
880 | //disconnect case, no new address | 880 | /* disconnect case, no new address */ |
881 | GNUNET_assert(0 == ntohl (agent->address_inuse->assigned_bw_in.value__)); | 881 | GNUNET_assert(0 == agent->address_inuse->assigned_bw_in); |
882 | GNUNET_assert(0 == ntohl (agent->address_inuse->assigned_bw_out.value__)); | 882 | GNUNET_assert(0 == agent->address_inuse->assigned_bw_out); |
883 | agent->bw_in = 0; | 883 | agent->bw_in = 0; |
884 | agent->bw_out = 0; | 884 | agent->bw_out = 0; |
885 | 885 | ||
diff --git a/src/ats/test_ats_api_common.c b/src/ats/test_ats_api_common.c index 934877024..b603d6e6d 100644 --- a/src/ats/test_ats_api_common.c +++ b/src/ats/test_ats_api_common.c | |||
@@ -266,8 +266,8 @@ create_address (const struct GNUNET_PeerIdentity *peer, | |||
266 | aa->active = GNUNET_NO; | 266 | aa->active = GNUNET_NO; |
267 | aa->used = GNUNET_NO; | 267 | aa->used = GNUNET_NO; |
268 | aa->solver_information = NULL; | 268 | aa->solver_information = NULL; |
269 | aa->assigned_bw_in = GNUNET_BANDWIDTH_value_init(0); | 269 | aa->assigned_bw_in = 0; |
270 | aa->assigned_bw_out = GNUNET_BANDWIDTH_value_init(0); | 270 | aa->assigned_bw_out = 0; |
271 | return aa; | 271 | return aa; |
272 | } | 272 | } |
273 | 273 | ||