diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-05-05 13:09:00 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-05-05 13:09:00 +0000 |
commit | 04763dd4b84cafbdab8eb8b60f02a36173aad412 (patch) | |
tree | e4907a9c8f62301e9a42819494776d3324b929c5 /src | |
parent | 2f166164c80ef5065d8899e0f9f123a148b742b6 (diff) | |
download | gnunet-04763dd4b84cafbdab8eb8b60f02a36173aad412.tar.gz gnunet-04763dd4b84cafbdab8eb8b60f02a36173aad412.zip |
fix: setting network in address with eval tool
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.c | 29 | ||||
-rw-r--r-- | src/ats/plugin_ats_mlp.c | 11 | ||||
-rw-r--r-- | src/ats/plugin_ats_ril.c | 2 |
3 files changed, 28 insertions, 14 deletions
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index 57e9ce69f..7a74833e8 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c | |||
@@ -211,8 +211,8 @@ GNUNET_ATS_solver_logging_now (struct LoggingHandle *l) | |||
211 | 211 | ||
212 | for (cur_addr = cur->addr_head; NULL != cur_addr; cur_addr = cur_addr->next) | 212 | for (cur_addr = cur->addr_head; NULL != cur_addr; cur_addr = cur_addr->next) |
213 | { | 213 | { |
214 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Logging peer id %llu address %llu\n", | 214 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Logging peer id %llu address %llu \n", |
215 | cur->peer_id, cur_addr->aid); | 215 | cur->id, cur_addr->aid); |
216 | log_a = GNUNET_new (struct LoggingAddress); | 216 | log_a = GNUNET_new (struct LoggingAddress); |
217 | log_a->aid = cur_addr->aid; | 217 | log_a->aid = cur_addr->aid; |
218 | log_a->active = cur_addr->ats_addr->active; | 218 | log_a->active = cur_addr->ats_addr->active; |
@@ -362,7 +362,7 @@ GNUNET_ATS_solver_logging_write_to_disk (struct LoggingHandle *l, int add_time_s | |||
362 | cur->aid, | 362 | cur->aid, |
363 | cur->pid); | 363 | cur->pid); |
364 | 364 | ||
365 | fprintf (stderr, "Add writing log data for %llu %llu to file `%s'\n", | 365 | fprintf (stderr, "Add writing log data for peer %llu address %llu to file `%s'\n", |
366 | cur->pid, cur->aid, filename); | 366 | cur->pid, cur->aid, filename); |
367 | 367 | ||
368 | 368 | ||
@@ -2022,12 +2022,19 @@ timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc) | |||
2022 | struct ATS_Address * | 2022 | struct ATS_Address * |
2023 | create_ats_address (const struct GNUNET_PeerIdentity *peer, | 2023 | create_ats_address (const struct GNUNET_PeerIdentity *peer, |
2024 | const char *plugin_name, | 2024 | const char *plugin_name, |
2025 | const void *plugin_addr, size_t plugin_addr_len, | 2025 | const void *plugin_addr, |
2026 | uint32_t session_id) | 2026 | size_t plugin_addr_len, |
2027 | uint32_t session_id, | ||
2028 | uint32_t network) | ||
2027 | { | 2029 | { |
2028 | struct ATS_Address *aa = NULL; | 2030 | struct ATS_Address *aa = NULL; |
2029 | 2031 | ||
2030 | aa = GNUNET_malloc (sizeof (struct ATS_Address) + plugin_addr_len + strlen (plugin_name) + 1); | 2032 | aa = GNUNET_malloc (sizeof (struct ATS_Address) + plugin_addr_len + strlen (plugin_name) + 1); |
2033 | aa->atsi = GNUNET_new (struct GNUNET_ATS_Information); | ||
2034 | aa->atsi[0].type = htonl (GNUNET_ATS_NETWORK_TYPE); | ||
2035 | aa->atsi[0].value = htonl (network); | ||
2036 | aa->atsi_count = 1; | ||
2037 | |||
2031 | aa->peer = *peer; | 2038 | aa->peer = *peer; |
2032 | aa->addr_len = plugin_addr_len; | 2039 | aa->addr_len = plugin_addr_len; |
2033 | aa->addr = &aa[1]; | 2040 | aa->addr = &aa[1]; |
@@ -2040,6 +2047,7 @@ create_ats_address (const struct GNUNET_PeerIdentity *peer, | |||
2040 | aa->solver_information = NULL; | 2047 | aa->solver_information = NULL; |
2041 | aa->assigned_bw_in = GNUNET_BANDWIDTH_value_init(0); | 2048 | aa->assigned_bw_in = GNUNET_BANDWIDTH_value_init(0); |
2042 | aa->assigned_bw_out = GNUNET_BANDWIDTH_value_init(0); | 2049 | aa->assigned_bw_out = GNUNET_BANDWIDTH_value_init(0); |
2050 | |||
2043 | return aa; | 2051 | return aa; |
2044 | } | 2052 | } |
2045 | 2053 | ||
@@ -2075,10 +2083,9 @@ enforce_add_address (struct GNUNET_ATS_TEST_Operation *op) | |||
2075 | 2083 | ||
2076 | a = GNUNET_new (struct TestAddress); | 2084 | a = GNUNET_new (struct TestAddress); |
2077 | a->aid = op->address_id; | 2085 | a->aid = op->address_id; |
2078 | fprintf (stderr, "XXXX : %llu %llu \n", a->aid, op->address_id); | ||
2079 | a->network = op->address_network; | 2086 | a->network = op->address_network; |
2080 | a->ats_addr = create_ats_address (&p->peer_id, op->plugin, op->address, | 2087 | a->ats_addr = create_ats_address (&p->peer_id, op->plugin, op->address, |
2081 | strlen (op->address) + 1, op->address_session); | 2088 | strlen (op->address) + 1, op->address_session, op->address_network); |
2082 | memset (&p->peer_id, op->peer_id, sizeof (p->peer_id)); | 2089 | memset (&p->peer_id, op->peer_id, sizeof (p->peer_id)); |
2083 | GNUNET_CONTAINER_DLL_insert_tail (p->addr_head, p->addr_tail, a); | 2090 | GNUNET_CONTAINER_DLL_insert_tail (p->addr_head, p->addr_tail, a); |
2084 | 2091 | ||
@@ -2089,7 +2096,7 @@ enforce_add_address (struct GNUNET_ATS_TEST_Operation *op) | |||
2089 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 2096 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
2090 | 2097 | ||
2091 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Adding address %u for peer %u in network `%s'\n", | 2098 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Adding address %u for peer %u in network `%s'\n", |
2092 | op->address_id, op->peer_id, GNUNET_ATS_print_network_type(op->address_network)); | 2099 | op->address_id, op->peer_id, GNUNET_ATS_print_network_type(a->network)); |
2093 | 2100 | ||
2094 | sh->env.sf.s_add (sh->solver, a->ats_addr, op->address_network); | 2101 | sh->env.sf.s_add (sh->solver, a->ats_addr, op->address_network); |
2095 | 2102 | ||
@@ -2131,6 +2138,7 @@ enforce_del_address (struct GNUNET_ATS_TEST_Operation *op) | |||
2131 | op->address_id, op->peer_id); | 2138 | op->address_id, op->peer_id); |
2132 | 2139 | ||
2133 | sh->env.sf.s_del (sh->solver, a->ats_addr, GNUNET_NO); | 2140 | sh->env.sf.s_del (sh->solver, a->ats_addr, GNUNET_NO); |
2141 | GNUNET_free_non_null(a->ats_addr->atsi); | ||
2134 | GNUNET_free (a->ats_addr); | 2142 | GNUNET_free (a->ats_addr); |
2135 | GNUNET_free (a); | 2143 | GNUNET_free (a); |
2136 | 2144 | ||
@@ -2244,7 +2252,10 @@ enforce_start_request (struct GNUNET_ATS_TEST_Operation *op) | |||
2244 | res = sh->env.sf.s_get (sh->solver, &p->peer_id); | 2252 | res = sh->env.sf.s_get (sh->solver, &p->peer_id); |
2245 | if (NULL != res) | 2253 | if (NULL != res) |
2246 | { | 2254 | { |
2247 | 2255 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Requesting address for peer %u: %llu %llu\n", | |
2256 | op->peer_id, | ||
2257 | ntohl(res->assigned_bw_in.value__), | ||
2258 | ntohl(res->assigned_bw_out.value__)); | ||
2248 | } | 2259 | } |
2249 | } | 2260 | } |
2250 | 2261 | ||
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c index 2a1dc7eb2..1ceb294ca 100644 --- a/src/ats/plugin_ats_mlp.c +++ b/src/ats/plugin_ats_mlp.c | |||
@@ -373,12 +373,12 @@ get_performance_info (struct ATS_Address *address, uint32_t type) | |||
373 | GNUNET_assert (NULL != address); | 373 | GNUNET_assert (NULL != address); |
374 | 374 | ||
375 | if ((NULL == address->atsi) || (0 == address->atsi_count)) | 375 | if ((NULL == address->atsi) || (0 == address->atsi_count)) |
376 | return GNUNET_ATS_VALUE_UNDEFINED; | 376 | return GNUNET_ATS_VALUE_UNDEFINED; |
377 | 377 | ||
378 | for (c1 = 0; c1 < address->atsi_count; c1++) | 378 | for (c1 = 0; c1 < address->atsi_count; c1++) |
379 | { | 379 | { |
380 | if (ntohl(address->atsi[c1].type) == type) | 380 | if (ntohl (address->atsi[c1].type) == type) |
381 | return ntohl(address->atsi[c1].value); | 381 | return ntohl (address->atsi[c1].value); |
382 | } | 382 | } |
383 | return GNUNET_ATS_VALUE_UNDEFINED; | 383 | return GNUNET_ATS_VALUE_UNDEFINED; |
384 | } | 384 | } |
@@ -737,7 +737,10 @@ mlp_create_problem_add_address_information (void *cls, | |||
737 | { | 737 | { |
738 | addr_net = get_performance_info (address, GNUNET_ATS_NETWORK_TYPE); | 738 | addr_net = get_performance_info (address, GNUNET_ATS_NETWORK_TYPE); |
739 | if (GNUNET_ATS_VALUE_UNDEFINED == addr_net) | 739 | if (GNUNET_ATS_VALUE_UNDEFINED == addr_net) |
740 | addr_net = GNUNET_ATS_NET_UNSPECIFIED; | 740 | { |
741 | GNUNET_break (0); | ||
742 | addr_net = GNUNET_ATS_NET_UNSPECIFIED; | ||
743 | } | ||
741 | 744 | ||
742 | if (mlp->pv.quota_index[c] == addr_net) | 745 | if (mlp->pv.quota_index[c] == addr_net) |
743 | { | 746 | { |
diff --git a/src/ats/plugin_ats_ril.c b/src/ats/plugin_ats_ril.c index f8d0738f5..6425ce777 100644 --- a/src/ats/plugin_ats_ril.c +++ b/src/ats/plugin_ats_ril.c | |||
@@ -1502,7 +1502,7 @@ agent_step (struct RIL_Peer_Agent *agent) | |||
1502 | 1502 | ||
1503 | GNUNET_assert(RIL_ACTION_INVALID != a_next); | 1503 | GNUNET_assert(RIL_ACTION_INVALID != a_next); |
1504 | 1504 | ||
1505 | LOG (GNUNET_ERROR_TYPE_INFO, "step() Step# %llu R: %f IN %llu OUT %llu A: %d\n", | 1505 | LOG (GNUNET_ERROR_TYPE_DEBUG, "step() Step# %llu R: %f IN %llu OUT %llu A: %d\n", |
1506 | agent->step_count, | 1506 | agent->step_count, |
1507 | reward, | 1507 | reward, |
1508 | agent->bw_in/1024, | 1508 | agent->bw_in/1024, |