aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-02-11 10:30:35 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-02-11 10:30:35 +0000
commitfaa12c86edbe689bf73a8dd51b4d4cb49ef0493c (patch)
tree51a5441341dfcb97dd76feb43f1a435c4670d626 /src
parenta2c33dc5a1e3d508eb8a8cb8646fd7e0413c0cb5 (diff)
downloadgnunet-faa12c86edbe689bf73a8dd51b4d4cb49ef0493c.tar.gz
gnunet-faa12c86edbe689bf73a8dd51b4d4cb49ef0493c.zip
improved quota loading + requesting and stopping address suggestions
Diffstat (limited to 'src')
-rw-r--r--src/ats/experiments/example.exp14
-rw-r--r--src/ats/experiments/gnunet_ats_sim_default.conf22
-rw-r--r--src/ats/gnunet-ats-solver-eval.c52
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
60op-1-peer-id = 1 60op-1-peer-id = 1
61op-1-pref = BANDWIDTH 61op-1-pref = BANDWIDTH
62 62
63op-2-operation = stop_set_property 63#op-2-operation = stop_set_property
64op-2-address-id = 0 64#op-2-address-id = 0
65op-2-peer-id = 0 65#op-2-peer-id = 0
66op-2-property = UTILIZATION_UP 66#op-2-property = UTILIZATION_UP
67 67
68op-3-operation = stop_request 68op-2-operation = stop_request
69op-3-peer-id = 0 \ No newline at end of file 69op-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]
3plugins = unix
4
5[ats] 1[ats]
6MODE = PROPORTIONAL 2UNSPECIFIED_QUOTA_IN = 64 KiB
3UNSPECIFIED_QUOTA_OUT = 64 KiB
4# LOOPBACK
5LOOPBACK_QUOTA_IN = 64 KiB
6LOOPBACK_QUOTA_OUT = 64 KiB
7# LAN
8LAN_QUOTA_IN = 64 KiB
9LAN_QUOTA_OUT = 64 KiB
10# WAN
11WAN_QUOTA_IN = 64 KiB
12WAN_QUOTA_OUT = 64 KiB
13# WLAN
14WLAN_QUOTA_IN = 64 KiB
15WLAN_QUOTA_OUT = 64 KiB
16# BLUETOOTH
17BLUETOOTH_QUOTA_IN = 64 KiB
18BLUETOOTH_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)
1905static void 1905static void
1906enforce_start_request (struct GNUNET_ATS_TEST_Operation *op) 1906enforce_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
1912static void 1930static void
1913enforce_stop_request (struct GNUNET_ATS_TEST_Operation *op) 1931enforce_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
1919static void enforce_episode (struct Episode *ep) 1949static 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