aboutsummaryrefslogtreecommitdiff
path: root/src/ats/test_ats_simplistic_pref_aging.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-03 14:11:03 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-03 14:11:03 +0000
commitb2e99dd91c01b5fcc16b3b1031df897aeec05eef (patch)
tree31caea8a19fd943f8a9f7f7f3c19e52e11d95a77 /src/ats/test_ats_simplistic_pref_aging.c
parent55cecdea8638fa23c68e7ade7a8d5629da658f9e (diff)
downloadgnunet-b2e99dd91c01b5fcc16b3b1031df897aeec05eef.tar.gz
gnunet-b2e99dd91c01b5fcc16b3b1031df897aeec05eef.zip
separate ATS connectivity suggestions from ATS scheduling API
Diffstat (limited to 'src/ats/test_ats_simplistic_pref_aging.c')
-rw-r--r--src/ats/test_ats_simplistic_pref_aging.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/ats/test_ats_simplistic_pref_aging.c b/src/ats/test_ats_simplistic_pref_aging.c
index 855e22fbf..654abfa5b 100644
--- a/src/ats/test_ats_simplistic_pref_aging.c
+++ b/src/ats/test_ats_simplistic_pref_aging.c
@@ -48,6 +48,11 @@ static struct GNUNET_SCHEDULER_Task * die_task;
48static struct GNUNET_ATS_SchedulingHandle *sched_ats; 48static struct GNUNET_ATS_SchedulingHandle *sched_ats;
49 49
50/** 50/**
51 * Connectivity handle
52 */
53static struct GNUNET_ATS_ConnectivityHandle *connect_ats;
54
55/**
51 * Performance handle 56 * Performance handle
52 */ 57 */
53static struct GNUNET_ATS_PerformanceHandle *perf_ats; 58static struct GNUNET_ATS_PerformanceHandle *perf_ats;
@@ -67,11 +72,15 @@ static struct Test_Address test_addr[2];
67 */ 72 */
68static struct PeerContext p[2]; 73static struct PeerContext p[2];
69 74
75/**
76 * Connectivity suggestion handles.
77 */
78static struct GNUNET_ATS_ConnectivitySuggestHandle *sh[2];
70 79
71/** 80/**
72 * HELLO address 81 * HELLO address
73 */ 82 */
74struct GNUNET_HELLO_Address test_hello_address[2]; 83static struct GNUNET_HELLO_Address test_hello_address[2];
75 84
76/** 85/**
77 * Session 86 * Session
@@ -81,22 +90,22 @@ static void *test_session[2];
81/** 90/**
82 * Test ats info 91 * Test ats info
83 */ 92 */
84struct GNUNET_ATS_Information test_ats_info[2]; 93static struct GNUNET_ATS_Information test_ats_info[2];
85 94
86/** 95/**
87 * Test ats count 96 * Test ats count
88 */ 97 */
89uint32_t test_ats_count; 98static uint32_t test_ats_count;
90 99
91/** 100/**
92 * Configured WAN out quota 101 * Configured WAN out quota
93 */ 102 */
94unsigned long long wan_quota_out; 103static unsigned long long wan_quota_out;
95 104
96/** 105/**
97 * Configured WAN in quota 106 * Configured WAN in quota
98 */ 107 */
99unsigned long long wan_quota_in; 108static unsigned long long wan_quota_in;
100 109
101 110
102static void 111static void
@@ -109,6 +118,11 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
109 GNUNET_ATS_scheduling_done (sched_ats); 118 GNUNET_ATS_scheduling_done (sched_ats);
110 sched_ats = NULL; 119 sched_ats = NULL;
111 } 120 }
121 if (NULL != connect_ats)
122 {
123 GNUNET_ATS_connectivity_done (connect_ats);
124 connect_ats = NULL;
125 }
112 if (perf_ats != NULL) 126 if (perf_ats != NULL)
113 { 127 {
114 GNUNET_ATS_performance_done (perf_ats); 128 GNUNET_ATS_performance_done (perf_ats);
@@ -129,8 +143,8 @@ end ()
129 die_task = NULL; 143 die_task = NULL;
130 } 144 }
131 145
132 GNUNET_ATS_suggest_address_cancel (sched_ats, &p[0].id); 146 GNUNET_ATS_connectivity_suggest_cancel (sh[0]);
133 GNUNET_ATS_suggest_address_cancel (sched_ats, &p[1].id); 147 GNUNET_ATS_connectivity_suggest_cancel (sh[1]);
134 148
135 if (NULL != sched_ats) 149 if (NULL != sched_ats)
136 GNUNET_ATS_scheduling_done (sched_ats); 150 GNUNET_ATS_scheduling_done (sched_ats);
@@ -366,6 +380,7 @@ run (void *cls,
366 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); 380 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
367 381
368 /* Connect to ATS scheduling */ 382 /* Connect to ATS scheduling */
383 connect_ats = GNUNET_ATS_connectivity_init (mycfg);
369 sched_ats = GNUNET_ATS_scheduling_init (cfg, &address_suggest_cb, NULL); 384 sched_ats = GNUNET_ATS_scheduling_init (cfg, &address_suggest_cb, NULL);
370 if (sched_ats == NULL) 385 if (sched_ats == NULL)
371 { 386 {
@@ -439,8 +454,8 @@ run (void *cls,
439 test_hello_address[1].address_length = test_addr[1].addr_len; 454 test_hello_address[1].address_length = test_addr[1].addr_len;
440 GNUNET_ATS_address_add (sched_ats, &test_hello_address[1], test_session[1], test_ats_info, test_ats_count); 455 GNUNET_ATS_address_add (sched_ats, &test_hello_address[1], test_session[1], test_ats_info, test_ats_count);
441 456
442 GNUNET_ATS_suggest_address (sched_ats, &p[0].id); 457 sh[0] = GNUNET_ATS_connectivity_suggest (connect_ats, &p[0].id);
443 GNUNET_ATS_suggest_address (sched_ats, &p[1].id); 458 sh[1] = GNUNET_ATS_connectivity_suggest (connect_ats, &p[1].id);
444} 459}
445 460
446 461