diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-02-11 10:30:35 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-02-11 10:30:35 +0000 |
commit | faa12c86edbe689bf73a8dd51b4d4cb49ef0493c (patch) | |
tree | 51a5441341dfcb97dd76feb43f1a435c4670d626 /src/ats | |
parent | a2c33dc5a1e3d508eb8a8cb8646fd7e0413c0cb5 (diff) | |
download | gnunet-faa12c86edbe689bf73a8dd51b4d4cb49ef0493c.tar.gz gnunet-faa12c86edbe689bf73a8dd51b4d4cb49ef0493c.zip |
improved quota loading + requesting and stopping address suggestions
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/experiments/example.exp | 14 | ||||
-rw-r--r-- | src/ats/experiments/gnunet_ats_sim_default.conf | 22 | ||||
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.c | 52 |
3 files changed, 66 insertions, 22 deletions
diff --git a/src/ats/experiments/example.exp b/src/ats/experiments/example.exp index da2ca0342..1edd83cfd 100644 --- a/src/ats/experiments/example.exp +++ b/src/ats/experiments/example.exp | |||
@@ -4,7 +4,7 @@ | |||
4 | slaves = 2 | 4 | slaves = 2 |
5 | max_duration = 15 s | 5 | max_duration = 15 s |
6 | log_freq = 1000 ms | 6 | log_freq = 1000 ms |
7 | cfg_file = gnunet_ats_sim_default.conf | 7 | cfg_file = experiments/gnunet_ats_sim_default.conf |
8 | 8 | ||
9 | [episode-0] | 9 | [episode-0] |
10 | # operations = address_add, address_del, start_set_property, stop_set_property, | 10 | # operations = address_add, address_del, start_set_property, stop_set_property, |
@@ -60,10 +60,10 @@ op-1-address-id = 1 | |||
60 | op-1-peer-id = 1 | 60 | op-1-peer-id = 1 |
61 | op-1-pref = BANDWIDTH | 61 | op-1-pref = BANDWIDTH |
62 | 62 | ||
63 | op-2-operation = stop_set_property | 63 | #op-2-operation = stop_set_property |
64 | op-2-address-id = 0 | 64 | #op-2-address-id = 0 |
65 | op-2-peer-id = 0 | 65 | #op-2-peer-id = 0 |
66 | op-2-property = UTILIZATION_UP | 66 | #op-2-property = UTILIZATION_UP |
67 | 67 | ||
68 | op-3-operation = stop_request | 68 | op-2-operation = stop_request |
69 | op-3-peer-id = 0 \ No newline at end of file | 69 | op-2-peer-id = 0 \ No newline at end of file |
diff --git a/src/ats/experiments/gnunet_ats_sim_default.conf b/src/ats/experiments/gnunet_ats_sim_default.conf index ca95eb923..14e0a2e0b 100644 --- a/src/ats/experiments/gnunet_ats_sim_default.conf +++ b/src/ats/experiments/gnunet_ats_sim_default.conf | |||
@@ -1,6 +1,18 @@ | |||
1 | @INLINE@ template_perf_ats.conf | ||
2 | [transport] | ||
3 | plugins = unix | ||
4 | |||
5 | [ats] | 1 | [ats] |
6 | MODE = PROPORTIONAL | 2 | UNSPECIFIED_QUOTA_IN = 64 KiB |
3 | UNSPECIFIED_QUOTA_OUT = 64 KiB | ||
4 | # LOOPBACK | ||
5 | LOOPBACK_QUOTA_IN = 64 KiB | ||
6 | LOOPBACK_QUOTA_OUT = 64 KiB | ||
7 | # LAN | ||
8 | LAN_QUOTA_IN = 64 KiB | ||
9 | LAN_QUOTA_OUT = 64 KiB | ||
10 | # WAN | ||
11 | WAN_QUOTA_IN = 64 KiB | ||
12 | WAN_QUOTA_OUT = 64 KiB | ||
13 | # WLAN | ||
14 | WLAN_QUOTA_IN = 64 KiB | ||
15 | WLAN_QUOTA_OUT = 64 KiB | ||
16 | # BLUETOOTH | ||
17 | BLUETOOTH_QUOTA_IN = 64 KiB | ||
18 | BLUETOOTH_QUOTA_OUT = 64 KiB | ||
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index 13afcf470..571c2930b 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c | |||
@@ -1905,15 +1905,45 @@ enforce_stop_preference (struct GNUNET_ATS_TEST_Operation *op) | |||
1905 | static void | 1905 | static void |
1906 | enforce_start_request (struct GNUNET_ATS_TEST_Operation *op) | 1906 | enforce_start_request (struct GNUNET_ATS_TEST_Operation *op) |
1907 | { | 1907 | { |
1908 | struct TestPeer *p; | ||
1909 | const struct ATS_Address *res; | ||
1910 | |||
1911 | if (NULL == (p = find_peer_by_id (op->peer_id))) | ||
1912 | { | ||
1913 | GNUNET_break (0); | ||
1914 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1915 | "Requesting address for unknown peer %u\n", op->peer_id); | ||
1916 | return; | ||
1917 | } | ||
1918 | |||
1908 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Requesting address for peer %u\n", | 1919 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Requesting address for peer %u\n", |
1909 | op->peer_id); | 1920 | op->peer_id); |
1921 | |||
1922 | res = sh->env.sf.s_get (sh->solver, &p->peer_id); | ||
1923 | if (NULL != res) | ||
1924 | { | ||
1925 | |||
1926 | } | ||
1927 | |||
1910 | } | 1928 | } |
1911 | 1929 | ||
1912 | static void | 1930 | static void |
1913 | enforce_stop_request (struct GNUNET_ATS_TEST_Operation *op) | 1931 | enforce_stop_request (struct GNUNET_ATS_TEST_Operation *op) |
1914 | { | 1932 | { |
1933 | struct TestPeer *p; | ||
1934 | |||
1935 | if (NULL == (p = find_peer_by_id (op->peer_id))) | ||
1936 | { | ||
1937 | GNUNET_break (0); | ||
1938 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1939 | "Requesting address for unknown peer %u\n", op->peer_id); | ||
1940 | return; | ||
1941 | } | ||
1942 | |||
1915 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stop requesting address for peer %u\n", | 1943 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stop requesting address for peer %u\n", |
1916 | op->peer_id); | 1944 | op->peer_id); |
1945 | |||
1946 | sh->env.sf.s_get_stop (sh->solver, &p->peer_id); | ||
1917 | } | 1947 | } |
1918 | 1948 | ||
1919 | static void enforce_episode (struct Episode *ep) | 1949 | static void enforce_episode (struct Episode *ep) |
@@ -2092,7 +2122,7 @@ GNUNET_ATS_solvers_experimentation_load (char *filename) | |||
2092 | } | 2122 | } |
2093 | else | 2123 | else |
2094 | { | 2124 | { |
2095 | fprintf (stderr, "Experiment name: `%s'\n", e->cfg_file); | 2125 | fprintf (stderr, "Experiment configuration: `%s'\n", e->cfg_file); |
2096 | e->cfg = GNUNET_CONFIGURATION_create(); | 2126 | e->cfg = GNUNET_CONFIGURATION_create(); |
2097 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (e->cfg, e->cfg_file)) | 2127 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (e->cfg, e->cfg_file)) |
2098 | { | 2128 | { |
@@ -2276,7 +2306,7 @@ GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
2276 | network_str[c], GNUNET_ATS_DefaultBandwidth); | 2306 | network_str[c], GNUNET_ATS_DefaultBandwidth); |
2277 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; | 2307 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; |
2278 | } | 2308 | } |
2279 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Loaded quota for network `%s' (in/out): %llu %llu\n", network_str[c], in_dest[c], out_dest[c]); | 2309 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Loaded quota for network `%s' (in/out): %llu %llu\n", network_str[c], in_dest[c], out_dest[c]); |
2280 | GNUNET_free (entry_out); | 2310 | GNUNET_free (entry_out); |
2281 | GNUNET_free (entry_in); | 2311 | GNUNET_free (entry_in); |
2282 | } | 2312 | } |
@@ -2384,9 +2414,14 @@ solver_bandwidth_changed_cb (void *cls, struct ATS_Address *address) | |||
2384 | { | 2414 | { |
2385 | if ( (0 == ntohl (address->assigned_bw_out.value__)) && | 2415 | if ( (0 == ntohl (address->assigned_bw_out.value__)) && |
2386 | (0 == ntohl (address->assigned_bw_in.value__)) ) | 2416 | (0 == ntohl (address->assigned_bw_in.value__)) ) |
2417 | { | ||
2418 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
2419 | "Solver notified to disconnect peer `%s'\n", | ||
2420 | GNUNET_i2s (&address->peer)); | ||
2387 | return; | 2421 | return; |
2422 | } | ||
2388 | 2423 | ||
2389 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2424 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
2390 | "Bandwidth changed addresses %s %p to %u Bps out / %u Bps in\n", | 2425 | "Bandwidth changed addresses %s %p to %u Bps out / %u Bps in\n", |
2391 | GNUNET_i2s (&address->peer), | 2426 | GNUNET_i2s (&address->peer), |
2392 | address, | 2427 | address, |
@@ -2423,8 +2458,6 @@ GNUNET_ATS_solvers_solver_start (enum GNUNET_ATS_Solvers type) | |||
2423 | { | 2458 | { |
2424 | struct SolverHandle *sh; | 2459 | struct SolverHandle *sh; |
2425 | char * solver_str; | 2460 | char * solver_str; |
2426 | unsigned long long quotas_in[GNUNET_ATS_NetworkTypeCount]; | ||
2427 | unsigned long long quotas_out[GNUNET_ATS_NetworkTypeCount]; | ||
2428 | 2461 | ||
2429 | switch (type) { | 2462 | switch (type) { |
2430 | case GNUNET_ATS_SOLVER_PROPORTIONAL: | 2463 | case GNUNET_ATS_SOLVER_PROPORTIONAL: |
@@ -2445,10 +2478,11 @@ GNUNET_ATS_solvers_solver_start (enum GNUNET_ATS_Solvers type) | |||
2445 | sh = GNUNET_new (struct SolverHandle); | 2478 | sh = GNUNET_new (struct SolverHandle); |
2446 | GNUNET_asprintf (&sh->plugin, "libgnunet_plugin_ats_%s", solver_str); | 2479 | GNUNET_asprintf (&sh->plugin, "libgnunet_plugin_ats_%s", solver_str); |
2447 | 2480 | ||
2481 | sh->addresses = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); | ||
2448 | /* setup environment */ | 2482 | /* setup environment */ |
2449 | sh->env.cfg = e->cfg; | 2483 | sh->env.cfg = e->cfg; |
2450 | sh->env.stats = GNUNET_STATISTICS_create ("ats", e->cfg); | 2484 | sh->env.stats = GNUNET_STATISTICS_create ("ats", e->cfg); |
2451 | sh->env.addresses = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); | 2485 | sh->env.addresses = sh->addresses; |
2452 | sh->env.bandwidth_changed_cb = &solver_bandwidth_changed_cb; | 2486 | sh->env.bandwidth_changed_cb = &solver_bandwidth_changed_cb; |
2453 | sh->env.get_preferences = &get_preferences_cb; | 2487 | sh->env.get_preferences = &get_preferences_cb; |
2454 | sh->env.get_property = &get_property_cb; | 2488 | sh->env.get_property = &get_property_cb; |
@@ -2456,12 +2490,13 @@ GNUNET_ATS_solvers_solver_start (enum GNUNET_ATS_Solvers type) | |||
2456 | sh->env.info_cb = &solver_info_cb; | 2490 | sh->env.info_cb = &solver_info_cb; |
2457 | sh->env.info_cb_cls = NULL; | 2491 | sh->env.info_cb_cls = NULL; |
2458 | 2492 | ||
2493 | |||
2459 | /* start normalization */ | 2494 | /* start normalization */ |
2460 | GAS_normalization_start (NULL, NULL, &normalized_property_changed_cb, NULL ); | 2495 | GAS_normalization_start (NULL, NULL, &normalized_property_changed_cb, NULL ); |
2461 | 2496 | ||
2462 | /* load quotas */ | 2497 | /* load quotas */ |
2463 | if (GNUNET_ATS_NetworkTypeCount != GNUNET_ATS_solvers_load_quotas (e->cfg, | 2498 | if (GNUNET_ATS_NetworkTypeCount != GNUNET_ATS_solvers_load_quotas (e->cfg, |
2464 | quotas_out, quotas_in, GNUNET_ATS_NetworkTypeCount)) | 2499 | sh->env.out_quota, sh->env.in_quota, GNUNET_ATS_NetworkTypeCount)) |
2465 | { | 2500 | { |
2466 | GNUNET_break(0); | 2501 | GNUNET_break(0); |
2467 | GNUNET_free (sh->plugin); | 2502 | GNUNET_free (sh->plugin); |
@@ -2480,9 +2515,6 @@ GNUNET_ATS_solvers_solver_start (enum GNUNET_ATS_Solvers type) | |||
2480 | end_now (); | 2515 | end_now (); |
2481 | return NULL; | 2516 | return NULL; |
2482 | } | 2517 | } |
2483 | |||
2484 | sh->addresses = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); | ||
2485 | |||
2486 | return sh; | 2518 | return sh; |
2487 | } | 2519 | } |
2488 | 2520 | ||