aboutsummaryrefslogtreecommitdiff
path: root/src/ats/test_ats_solver_preferences.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_solver_preferences.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_solver_preferences.c')
-rw-r--r--src/ats/test_ats_solver_preferences.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/ats/test_ats_solver_preferences.c b/src/ats/test_ats_solver_preferences.c
index 611f639bf..5c2206c26 100644
--- a/src/ats/test_ats_solver_preferences.c
+++ b/src/ats/test_ats_solver_preferences.c
@@ -51,7 +51,12 @@ static struct GNUNET_STATISTICS_Handle *stats;
51static struct GNUNET_ATS_SchedulingHandle *sched_ats; 51static struct GNUNET_ATS_SchedulingHandle *sched_ats;
52 52
53/** 53/**
54 * Scheduling handle 54 * Connectivity handle
55 */
56static struct GNUNET_ATS_ConnectivityHandle *connect_ats;
57
58/**
59 * Performance handle
55 */ 60 */
56static struct GNUNET_ATS_PerformanceHandle *perf_ats; 61static struct GNUNET_ATS_PerformanceHandle *perf_ats;
57 62
@@ -95,6 +100,7 @@ static int
95stat_cb (void *cls, const char *subsystem, const char *name, uint64_t value, 100stat_cb (void *cls, const char *subsystem, const char *name, uint64_t value,
96 int is_persistent); 101 int is_persistent);
97 102
103
98static void 104static void
99end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 105end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
100{ 106{
@@ -111,7 +117,11 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
111 GNUNET_ATS_scheduling_done (sched_ats); 117 GNUNET_ATS_scheduling_done (sched_ats);
112 sched_ats = NULL; 118 sched_ats = NULL;
113 } 119 }
114 120 if (NULL != connect_ats)
121 {
122 GNUNET_ATS_connectivity_done (connect_ats);
123 connect_ats = NULL;
124 }
115 if (NULL != perf_ats) 125 if (NULL != perf_ats)
116 { 126 {
117 GNUNET_ATS_performance_done (perf_ats); 127 GNUNET_ATS_performance_done (perf_ats);
@@ -203,6 +213,7 @@ stat_cb (void *cls, const char *subsystem, const char *name, uint64_t value,
203 return GNUNET_OK; 213 return GNUNET_OK;
204} 214}
205 215
216
206static void 217static void
207run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, 218run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg,
208 struct GNUNET_TESTING_Peer *peer) 219 struct GNUNET_TESTING_Peer *peer)
@@ -212,6 +223,8 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg,
212 stats = GNUNET_STATISTICS_create ("ats", mycfg); 223 stats = GNUNET_STATISTICS_create ("ats", mycfg);
213 GNUNET_STATISTICS_watch (stats, "ats", "# active performance clients", &stat_cb, NULL ); 224 GNUNET_STATISTICS_watch (stats, "ats", "# active performance clients", &stat_cb, NULL );
214 225
226 connect_ats = GNUNET_ATS_connectivity_init (mycfg);
227
215 /* Connect to ATS scheduling */ 228 /* Connect to ATS scheduling */
216 sched_ats = GNUNET_ATS_scheduling_init (mycfg, &address_suggest_cb, NULL ); 229 sched_ats = GNUNET_ATS_scheduling_init (mycfg, &address_suggest_cb, NULL );
217 if (sched_ats == NULL ) 230 if (sched_ats == NULL )
@@ -258,7 +271,7 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg,
258 /* Adding address */ 271 /* Adding address */
259 GNUNET_ATS_address_add (sched_ats, &test_hello_address, test_session, 272 GNUNET_ATS_address_add (sched_ats, &test_hello_address, test_session,
260 test_ats_info, test_ats_count); 273 test_ats_info, test_ats_count);
261 GNUNET_ATS_suggest_address(sched_ats, &test_hello_address.peer); 274 GNUNET_ATS_connectivity_suggest (connect_ats, &test_hello_address.peer);
262} 275}
263 276
264 277