diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-17 21:31:48 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-17 21:31:48 +0000 |
commit | c76f29f898f6b1a73f33ce6d2578e06ce8e0a24e (patch) | |
tree | 4d9fbf87fa9d65b8b966b51739af96205943be8f /src/ats/plugin_ats_proportional.c | |
parent | f6323d915af7494ecfeba39407d1c30dc06dc238 (diff) | |
download | gnunet-c76f29f898f6b1a73f33ce6d2578e06ce8e0a24e.tar.gz gnunet-c76f29f898f6b1a73f33ce6d2578e06ce8e0a24e.zip |
use ATS functions to convert quality network type to string, instead of using string API
Diffstat (limited to 'src/ats/plugin_ats_proportional.c')
-rw-r--r-- | src/ats/plugin_ats_proportional.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c index 744602eb8..99cbb1b55 100644 --- a/src/ats/plugin_ats_proportional.c +++ b/src/ats/plugin_ats_proportional.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_statistics_service.h" | 28 | #include "gnunet_statistics_service.h" |
29 | #include "gnunet_ats_plugin.h" | 29 | #include "gnunet_ats_plugin.h" |
30 | #include "gnunet_ats_service.h" | ||
30 | #include "gnunet-service-ats_addresses.h" | 31 | #include "gnunet-service-ats_addresses.h" |
31 | 32 | ||
32 | #define PROP_STABILITY_FACTOR 1.25 | 33 | #define PROP_STABILITY_FACTOR 1.25 |
@@ -317,7 +318,7 @@ struct Network | |||
317 | /** | 318 | /** |
318 | * Network description | 319 | * Network description |
319 | */ | 320 | */ |
320 | char *desc; | 321 | const char *desc; |
321 | 322 | ||
322 | /** | 323 | /** |
323 | * Total inbound quota | 324 | * Total inbound quota |
@@ -1293,7 +1294,7 @@ update_active_address (struct GAS_PROPORTIONAL_Handle *s, | |||
1293 | best_address->active = GNUNET_YES; | 1294 | best_address->active = GNUNET_YES; |
1294 | address_increment (s, net, GNUNET_NO, GNUNET_YES); | 1295 | address_increment (s, net, GNUNET_NO, GNUNET_YES); |
1295 | LOG (GNUNET_ERROR_TYPE_INFO, "Address %p for peer `%s' is now active\n", | 1296 | LOG (GNUNET_ERROR_TYPE_INFO, "Address %p for peer `%s' is now active\n", |
1296 | best_address, GNUNET_i2s (peer)); | 1297 | best_address, GNUNET_i2s (peer)); |
1297 | /* Distribute bandwidth */ | 1298 | /* Distribute bandwidth */ |
1298 | distribute_bandwidth_in_network (s, net); | 1299 | distribute_bandwidth_in_network (s, net); |
1299 | return best_address; | 1300 | return best_address; |
@@ -1936,7 +1937,6 @@ libgnunet_plugin_ats_proportional_init (void *cls) | |||
1936 | struct GNUNET_ATS_PluginEnvironment *env = cls; | 1937 | struct GNUNET_ATS_PluginEnvironment *env = cls; |
1937 | struct GAS_PROPORTIONAL_Handle *s; | 1938 | struct GAS_PROPORTIONAL_Handle *s; |
1938 | struct Network * cur; | 1939 | struct Network * cur; |
1939 | char * net_str[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkTypeString; | ||
1940 | float f_tmp; | 1940 | float f_tmp; |
1941 | int c; | 1941 | int c; |
1942 | 1942 | ||
@@ -2022,19 +2022,22 @@ libgnunet_plugin_ats_proportional_init (void *cls) | |||
2022 | for (c = 0; c < env->network_count; c++) | 2022 | for (c = 0; c < env->network_count; c++) |
2023 | { | 2023 | { |
2024 | cur = &s->network_entries[c]; | 2024 | cur = &s->network_entries[c]; |
2025 | cur->total_addresses = 0; | ||
2026 | cur->active_addresses = 0; | ||
2027 | cur->type = env->networks[c]; | 2025 | cur->type = env->networks[c]; |
2028 | cur->total_quota_in = env->in_quota[c]; | 2026 | cur->total_quota_in = env->in_quota[c]; |
2029 | cur->total_quota_out = env->out_quota[c]; | 2027 | cur->total_quota_out = env->out_quota[c]; |
2030 | cur->desc = net_str[c]; | 2028 | cur->desc = GNUNET_ATS_print_network_type (c); |
2031 | GNUNET_asprintf (&cur->stat_total, | 2029 | GNUNET_asprintf (&cur->stat_total, |
2032 | "# ATS addresses %s total", cur->desc); | 2030 | "# ATS addresses %s total", |
2031 | cur->desc); | ||
2033 | GNUNET_asprintf (&cur->stat_active, | 2032 | GNUNET_asprintf (&cur->stat_active, |
2034 | "# ATS active addresses %s total", cur->desc); | 2033 | "# ATS active addresses %s total", |
2034 | cur->desc); | ||
2035 | LOG (GNUNET_ERROR_TYPE_INFO, | 2035 | LOG (GNUNET_ERROR_TYPE_INFO, |
2036 | "Added network %u `%s' (%llu/%llu)\n", | 2036 | "Added network %u `%s' (%llu/%llu)\n", |
2037 | c, cur->desc, cur->total_quota_in, cur->total_quota_out); | 2037 | c, |
2038 | cur->desc, | ||
2039 | cur->total_quota_in, | ||
2040 | cur->total_quota_out); | ||
2038 | } | 2041 | } |
2039 | return s; | 2042 | return s; |
2040 | } | 2043 | } |