diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-04-14 16:48:37 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-04-14 16:48:37 +0000 |
commit | 3c2d8c16ca76ac45db471f3c66bc24257b849dd5 (patch) | |
tree | 5aa7eb3d2bd08b5e849cf8843c6311c875affe60 /src/transport/test_transport_ats.c | |
parent | 57a074bce8ef0c538d1b1906c9de7482275232fb (diff) | |
download | gnunet-3c2d8c16ca76ac45db471f3c66bc24257b849dd5.tar.gz gnunet-3c2d8c16ca76ac45db471f3c66bc24257b849dd5.zip |
many changes...improvements
Diffstat (limited to 'src/transport/test_transport_ats.c')
-rw-r--r-- | src/transport/test_transport_ats.c | 286 |
1 files changed, 244 insertions, 42 deletions
diff --git a/src/transport/test_transport_ats.c b/src/transport/test_transport_ats.c index 5c5334812..e83080a1a 100644 --- a/src/transport/test_transport_ats.c +++ b/src/transport/test_transport_ats.c | |||
@@ -23,6 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_testing_lib.h" | 25 | #include "gnunet_testing_lib.h" |
26 | #include "gnunet_transport_service.h" | ||
26 | #include "gnunet_scheduler_lib.h" | 27 | #include "gnunet_scheduler_lib.h" |
27 | #include "gauger.h" | 28 | #include "gauger.h" |
28 | 29 | ||
@@ -33,7 +34,13 @@ | |||
33 | 34 | ||
34 | #define DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300) | 35 | #define DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300) |
35 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300) | 36 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300) |
37 | #define SEND_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | ||
36 | 38 | ||
39 | #define ATS_NEW 0 | ||
40 | #define ATS_Q_UPDATED 1 | ||
41 | #define ATS_C_UPDATED 2 | ||
42 | #define ATS_QC_UPDATED 3 | ||
43 | #define ATS_UNMODIFIED 4 | ||
37 | 44 | ||
38 | static int ok; | 45 | static int ok; |
39 | 46 | ||
@@ -47,7 +54,9 @@ static struct GNUNET_TESTING_PeerGroup *pg; | |||
47 | 54 | ||
48 | static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; | 55 | static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; |
49 | static GNUNET_SCHEDULER_TaskIdentifier stats_task; | 56 | static GNUNET_SCHEDULER_TaskIdentifier stats_task; |
57 | static GNUNET_SCHEDULER_TaskIdentifier send_task; | ||
50 | struct GNUNET_TESTING_Daemon * master_deamon; | 58 | struct GNUNET_TESTING_Daemon * master_deamon; |
59 | struct GNUNET_TESTING_Daemon * ping_deamon; | ||
51 | 60 | ||
52 | struct GNUNET_STATISTICS_Handle * stats; | 61 | struct GNUNET_STATISTICS_Handle * stats; |
53 | 62 | ||
@@ -58,14 +67,31 @@ struct TEST_result | |||
58 | uint64_t mechs; | 67 | uint64_t mechs; |
59 | uint64_t peers; | 68 | uint64_t peers; |
60 | uint64_t solution; | 69 | uint64_t solution; |
70 | uint64_t state; | ||
61 | }; | 71 | }; |
62 | 72 | ||
63 | static int r_index; | 73 | struct TestMessage |
64 | //static int measurements; | 74 | { |
75 | struct GNUNET_MessageHeader header; | ||
76 | uint32_t num; | ||
77 | }; | ||
78 | |||
79 | |||
80 | static int count; | ||
81 | static int c_new; | ||
82 | static int c_unmodified; | ||
83 | static int c_modified; | ||
65 | static int connected; | 84 | static int connected; |
66 | static int peers; | 85 | static int peers; |
67 | 86 | ||
68 | static struct TEST_result results[MEASUREMENTS]; | 87 | static int force_q_updates; |
88 | static int force_rebuild; | ||
89 | static int send_msg; | ||
90 | |||
91 | static struct TEST_result results_new [MEASUREMENTS+1]; | ||
92 | static struct TEST_result results_modified [MEASUREMENTS+1]; | ||
93 | static struct TEST_result results_unmodified[MEASUREMENTS+1]; | ||
94 | static struct TEST_result current; | ||
69 | 95 | ||
70 | static struct GNUNET_STATISTICS_GetHandle * s_solution; | 96 | static struct GNUNET_STATISTICS_GetHandle * s_solution; |
71 | static struct GNUNET_STATISTICS_GetHandle * s_time; | 97 | static struct GNUNET_STATISTICS_GetHandle * s_time; |
@@ -73,6 +99,10 @@ static struct GNUNET_STATISTICS_GetHandle * s_peers; | |||
73 | static struct GNUNET_STATISTICS_GetHandle * s_mechs; | 99 | static struct GNUNET_STATISTICS_GetHandle * s_mechs; |
74 | static struct GNUNET_STATISTICS_GetHandle * s_duration; | 100 | static struct GNUNET_STATISTICS_GetHandle * s_duration; |
75 | static struct GNUNET_STATISTICS_GetHandle * s_invalid; | 101 | static struct GNUNET_STATISTICS_GetHandle * s_invalid; |
102 | static struct GNUNET_STATISTICS_GetHandle * s_state; | ||
103 | |||
104 | struct GNUNET_TRANSPORT_TransmitHandle * t; | ||
105 | struct GNUNET_TRANSPORT_Handle * th; | ||
76 | 106 | ||
77 | /** | 107 | /** |
78 | * Check whether peers successfully shut down. | 108 | * Check whether peers successfully shut down. |
@@ -112,6 +142,19 @@ static void shutdown_peers() | |||
112 | GNUNET_SCHEDULER_cancel(stats_task); | 142 | GNUNET_SCHEDULER_cancel(stats_task); |
113 | stats_task = GNUNET_SCHEDULER_NO_TASK; | 143 | stats_task = GNUNET_SCHEDULER_NO_TASK; |
114 | } | 144 | } |
145 | if (send_task != GNUNET_SCHEDULER_NO_TASK) | ||
146 | { | ||
147 | GNUNET_SCHEDULER_cancel(send_task); | ||
148 | send_task = GNUNET_SCHEDULER_NO_TASK; | ||
149 | } | ||
150 | |||
151 | if (t!=NULL) | ||
152 | { | ||
153 | GNUNET_TRANSPORT_notify_transmit_ready_cancel(t); | ||
154 | t = NULL; | ||
155 | } | ||
156 | |||
157 | GNUNET_TRANSPORT_disconnect(th); | ||
115 | 158 | ||
116 | if (s_time != NULL) | 159 | if (s_time != NULL) |
117 | { | 160 | { |
@@ -143,6 +186,11 @@ static void shutdown_peers() | |||
143 | GNUNET_STATISTICS_get_cancel(s_invalid); | 186 | GNUNET_STATISTICS_get_cancel(s_invalid); |
144 | s_invalid = NULL; | 187 | s_invalid = NULL; |
145 | } | 188 | } |
189 | if (s_state != NULL) | ||
190 | { | ||
191 | GNUNET_STATISTICS_get_cancel(s_state); | ||
192 | s_state = NULL; | ||
193 | } | ||
146 | 194 | ||
147 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 195 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
148 | } | 196 | } |
@@ -150,34 +198,62 @@ static void shutdown_peers() | |||
150 | static void evaluate_measurements() | 198 | static void evaluate_measurements() |
151 | { | 199 | { |
152 | int c; | 200 | int c; |
153 | char * output = NULL; | 201 | double average ; |
154 | char * temp; | ||
155 | double average; | ||
156 | double stddev; | 202 | double stddev; |
157 | double measure = MEASUREMENTS; | 203 | |
158 | for (c=0; c<MEASUREMENTS;c++) | 204 | c = 1; |
205 | |||
206 | average = 0.0; | ||
207 | for (c=0; c<c_new;c++) | ||
159 | { | 208 | { |
160 | average += (double) results[c].duration; | 209 | average += (double) results_new[c].duration; |
161 | GNUNET_asprintf(&temp, "%sm%i,%llu,%llu,%llu,%llu,", (output==NULL) ? "" : output, c, results[c].peers, results[c].mechs, results[c].duration, results[c].solution); | ||
162 | GNUNET_free_non_null (output); | ||
163 | output = temp; | ||
164 | } | 210 | } |
165 | average /= measure; | 211 | average /= c_new; |
166 | 212 | ||
167 | for (c=0; c<MEASUREMENTS;c++) | 213 | stddev = 0.0; |
214 | for (c=0; c<c_new;c++) | ||
168 | { | 215 | { |
169 | stddev += (results[c].duration - average) * (results[c].duration - average); | 216 | stddev += (results_new[c].duration - average) * (results_new[c].duration - average); |
170 | } | 217 | } |
171 | stddev /= measure; | 218 | stddev /= c_new; |
172 | stddev = sqrt (stddev); | 219 | stddev = sqrt (stddev); |
220 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"new average: %f stddev: %f\n", average, stddev); | ||
221 | |||
222 | average = 0.0; | ||
223 | for (c=0; c<c_modified;c++) | ||
224 | { | ||
225 | average += (double) results_modified[c].duration; | ||
226 | } | ||
227 | average /= c_modified; | ||
228 | |||
229 | stddev = 0.0; | ||
230 | for (c=0; c<c_modified;c++) | ||
231 | { | ||
232 | stddev += (results_modified[c].duration - average) * (results_modified[c].duration - average); | ||
233 | } | ||
234 | stddev /= c_modified; | ||
235 | stddev = sqrt (stddev); | ||
236 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"modified average: %f stddev: %f\n", average, stddev); | ||
237 | |||
238 | average = 0.0; | ||
239 | for (c=0; c<c_unmodified;c++) | ||
240 | { | ||
241 | average += (double) results_unmodified[c].duration; | ||
242 | } | ||
243 | average /= c_unmodified; | ||
244 | stddev = 0.0; | ||
245 | for (c=0; c<c_unmodified;c++) | ||
246 | { | ||
247 | stddev += (results_unmodified[c].duration - average) * (results_unmodified[c].duration - average); | ||
248 | } | ||
249 | stddev /= c_unmodified; | ||
250 | stddev = sqrt (stddev); | ||
251 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"unmodified average: %f stddev: %f\n", average, stddev); | ||
252 | |||
253 | |||
254 | |||
255 | |||
173 | 256 | ||
174 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"%savg,%f,stddev,%f\n",output,average,stddev); | ||
175 | /* only log benchmark time for 10 peers */ | ||
176 | if (results[MEASUREMENTS-1].peers == (10)) | ||
177 | { | ||
178 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Send data to gauger: %f \n", average); | ||
179 | GAUGER ("TRANSPORT", "ATS execution time 10 peers", average , "ms"); | ||
180 | } | ||
181 | shutdown_peers(); | 257 | shutdown_peers(); |
182 | } | 258 | } |
183 | 259 | ||
@@ -187,6 +263,8 @@ int stats_cb (void *cls, | |||
187 | uint64_t value, | 263 | uint64_t value, |
188 | int is_persistent) | 264 | int is_persistent) |
189 | { | 265 | { |
266 | static int printed = GNUNET_NO; | ||
267 | //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s = %llu\n", name ,value); | ||
190 | if (0 == strcmp (name,"ATS invalid solutions")) | 268 | if (0 == strcmp (name,"ATS invalid solutions")) |
191 | { | 269 | { |
192 | if (stats_task != GNUNET_SCHEDULER_NO_TASK) | 270 | if (stats_task != GNUNET_SCHEDULER_NO_TASK) |
@@ -222,11 +300,15 @@ int stats_cb (void *cls, | |||
222 | { | 300 | { |
223 | s_time = NULL; | 301 | s_time = NULL; |
224 | } | 302 | } |
303 | if (0 == strcmp (name,"ATS state")) | ||
304 | { | ||
305 | s_state = NULL; | ||
306 | } | ||
225 | 307 | ||
226 | if ((measurement_started == GNUNET_NO) && (0 == strcmp (name, "ATS peers")) && (value == peers-1)) | 308 | if ((measurement_started == GNUNET_NO) && (0 == strcmp (name, "ATS peers")) && (value == peers-1)) |
227 | { | 309 | { |
228 | measurement_started = GNUNET_YES; | 310 | measurement_started = GNUNET_YES; |
229 | r_index = 0; | 311 | count = 1; |
230 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All %llu peers connected\n", value); | 312 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All %llu peers connected\n", value); |
231 | } | 313 | } |
232 | 314 | ||
@@ -235,13 +317,57 @@ int stats_cb (void *cls, | |||
235 | // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s == %llu\n", name ,value); | 317 | // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s == %llu\n", name ,value); |
236 | if (0 == strcmp (name,"ATS timestamp")) | 318 | if (0 == strcmp (name,"ATS timestamp")) |
237 | { | 319 | { |
238 | if (results[r_index].timestamp == 0) | 320 | if (current.timestamp == 0) |
239 | results[r_index].timestamp = value; | 321 | { |
240 | if (results[r_index].timestamp != value) | 322 | printed = GNUNET_NO; |
323 | current.timestamp = value; | ||
324 | } | ||
325 | if (current.timestamp == value) | ||
326 | { | ||
327 | printed = GNUNET_YES; | ||
328 | } | ||
329 | if (current.timestamp != value) | ||
241 | { | 330 | { |
242 | r_index++; | 331 | if (current.state == ATS_NEW) |
243 | fprintf(stdout, "(%i/%i)", r_index, MEASUREMENTS); | 332 | { |
244 | if (r_index >= MEASUREMENTS) | 333 | if (c_new < MEASUREMENTS) |
334 | { | ||
335 | results_new[c_new] = current; | ||
336 | c_new++; | ||
337 | } | ||
338 | else | ||
339 | { | ||
340 | force_rebuild = GNUNET_NO; | ||
341 | force_q_updates = GNUNET_NO; | ||
342 | send_msg = GNUNET_NO; | ||
343 | } | ||
344 | } | ||
345 | if (current.state == ATS_UNMODIFIED) | ||
346 | { | ||
347 | if (c_unmodified < MEASUREMENTS) | ||
348 | { | ||
349 | results_unmodified[c_unmodified] = current; | ||
350 | c_unmodified++; | ||
351 | } | ||
352 | |||
353 | } | ||
354 | if (current.state == ATS_Q_UPDATED) | ||
355 | { | ||
356 | if (c_modified < MEASUREMENTS) | ||
357 | { | ||
358 | results_modified[c_modified] = current; | ||
359 | c_modified++; | ||
360 | } | ||
361 | else | ||
362 | { | ||
363 | force_q_updates = GNUNET_NO; | ||
364 | force_rebuild = GNUNET_YES; | ||
365 | } | ||
366 | } | ||
367 | count ++; | ||
368 | |||
369 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "(new: %i / modified: %i / unmodified: %i) of %i \n", c_new, c_modified, c_unmodified , MEASUREMENTS); | ||
370 | if ((count > MEASUREMENTS * 4) || ((c_modified >= MEASUREMENTS) && (c_new >= MEASUREMENTS) && (c_unmodified >= MEASUREMENTS))) | ||
245 | { | 371 | { |
246 | fprintf(stdout, "\n"); | 372 | fprintf(stdout, "\n"); |
247 | if (stats_task != GNUNET_SCHEDULER_NO_TASK) | 373 | if (stats_task != GNUNET_SCHEDULER_NO_TASK) |
@@ -252,35 +378,51 @@ int stats_cb (void *cls, | |||
252 | evaluate_measurements(); | 378 | evaluate_measurements(); |
253 | return GNUNET_SYSERR; | 379 | return GNUNET_SYSERR; |
254 | } | 380 | } |
255 | fprintf(stdout, ".."); | ||
256 | 381 | ||
257 | results[r_index].timestamp = value; | 382 | printed = GNUNET_NO; |
383 | current.timestamp = value; | ||
258 | return GNUNET_OK; | 384 | return GNUNET_OK; |
259 | } | 385 | } |
260 | } | 386 | } |
261 | 387 | ||
262 | if (0 == strcmp (name,"ATS solution")) | 388 | if (0 == strcmp (name,"ATS solution")) |
263 | { | 389 | { |
264 | results[r_index].solution = value; | 390 | current.solution = value; |
265 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "[%i] ATS solution: %s %llu \n", r_index, name, value); | 391 | if (printed == GNUNET_NO) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "[%i] %s: %llu \n", count, name, value); |
266 | } | 392 | } |
267 | 393 | ||
268 | if (0 == strcmp (name,"ATS peers")) | 394 | if (0 == strcmp (name,"ATS peers")) |
269 | { | 395 | { |
270 | results[r_index].peers = value; | 396 | current.peers = value; |
271 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "[%i] ATS peers: %s %llu \n", r_index, name, value); | 397 | if (printed == GNUNET_NO) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "[%i] %s: %llu \n", count, name, value); |
272 | } | 398 | } |
273 | 399 | ||
274 | if (0 == strcmp (name,"ATS mechanisms")) | 400 | if (0 == strcmp (name,"ATS mechanisms")) |
275 | { | 401 | { |
276 | results[r_index].mechs = value; | 402 | current.mechs = value; |
277 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "[%i] ATS mechanisms: %s %llu \n", r_index, name, value); | 403 | if (printed == GNUNET_NO) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "[%i] %s: %llu \n", count, name, value); |
278 | } | 404 | } |
279 | 405 | ||
280 | if (0 == strcmp (name,"ATS duration")) | 406 | if (0 == strcmp (name,"ATS duration")) |
281 | { | 407 | { |
282 | results[r_index].duration = value; | 408 | current.duration = value; |
283 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "[%i] ATS duration: %s %llu \n", r_index, name, value); | 409 | if (printed == GNUNET_NO) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "[%i] %s: %llu \n", count, name, value); |
410 | } | ||
411 | if (0 == strcmp (name,"ATS state")) | ||
412 | { | ||
413 | current.state = value; | ||
414 | char * cont; | ||
415 | if (value == ATS_NEW) | ||
416 | cont = "NEW"; | ||
417 | if (value == ATS_C_UPDATED) | ||
418 | cont = "C_UPDATED"; | ||
419 | if (value == ATS_Q_UPDATED) | ||
420 | cont = "Q_UPDATED"; | ||
421 | if (value == ATS_QC_UPDATED) | ||
422 | cont = "QC_UPDATED"; | ||
423 | if (value == ATS_UNMODIFIED) | ||
424 | cont = "UNMODIFIED"; | ||
425 | if (printed == GNUNET_NO) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "[%i] ATS state: %s\n", count, cont); | ||
284 | } | 426 | } |
285 | } | 427 | } |
286 | return GNUNET_OK; | 428 | return GNUNET_OK; |
@@ -301,7 +443,7 @@ stats_get_task (void *cls, | |||
301 | s_peers = GNUNET_STATISTICS_get (stats, "transport", "ATS peers", TIMEOUT, NULL, &stats_cb, NULL); | 443 | s_peers = GNUNET_STATISTICS_get (stats, "transport", "ATS peers", TIMEOUT, NULL, &stats_cb, NULL); |
302 | s_mechs = GNUNET_STATISTICS_get (stats, "transport", "ATS mechanisms", TIMEOUT, NULL, &stats_cb, NULL); | 444 | s_mechs = GNUNET_STATISTICS_get (stats, "transport", "ATS mechanisms", TIMEOUT, NULL, &stats_cb, NULL); |
303 | s_invalid = GNUNET_STATISTICS_get (stats, "transport", "ATS invalid solutions", TIMEOUT, NULL, &stats_cb, NULL); | 445 | s_invalid = GNUNET_STATISTICS_get (stats, "transport", "ATS invalid solutions", TIMEOUT, NULL, &stats_cb, NULL); |
304 | 446 | s_state = GNUNET_STATISTICS_get (stats, "transport", "ATS state", TIMEOUT, NULL, &stats_cb, NULL); | |
305 | 447 | ||
306 | stats_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250), &stats_get_task, NULL); | 448 | stats_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250), &stats_get_task, NULL); |
307 | } | 449 | } |
@@ -326,6 +468,46 @@ static void connect_peers() | |||
326 | 468 | ||
327 | } | 469 | } |
328 | 470 | ||
471 | size_t send_dummy_data_task (void *cls, size_t size, void *buf) | ||
472 | { | ||
473 | |||
474 | int s = sizeof (struct TestMessage); | ||
475 | struct TestMessage hdr; | ||
476 | |||
477 | hdr.header.size = htons (s); | ||
478 | hdr.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ATS); | ||
479 | if (force_rebuild) | ||
480 | hdr.num = htonl (1); | ||
481 | if (force_q_updates) | ||
482 | hdr.num = htonl (2); | ||
483 | |||
484 | |||
485 | memcpy (buf,&hdr, s); | ||
486 | // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Sent bytes: %i of %i\n", s, s); | ||
487 | t = NULL; | ||
488 | return s; | ||
489 | } | ||
490 | |||
491 | void send_task_f (void *cls, | ||
492 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
493 | { | ||
494 | send_task = GNUNET_SCHEDULER_NO_TASK; | ||
495 | if ( (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) | ||
496 | return; | ||
497 | |||
498 | if (t!=NULL) | ||
499 | { | ||
500 | GNUNET_TRANSPORT_notify_transmit_ready_cancel(t); | ||
501 | t = NULL; | ||
502 | } | ||
503 | // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Sent bytes: %i to %s\n", size, GNUNET_i2s(&master_deamon->id)); | ||
504 | if (send_msg == GNUNET_YES) | ||
505 | t = GNUNET_TRANSPORT_notify_transmit_ready(th, &master_deamon->id, sizeof (struct TestMessage), 0, SEND_TIMEOUT, &send_dummy_data_task, NULL); | ||
506 | send_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS,1000), &send_task_f, NULL); | ||
507 | } | ||
508 | |||
509 | |||
510 | |||
329 | void daemon_connect_cb(void *cls, | 511 | void daemon_connect_cb(void *cls, |
330 | const struct GNUNET_PeerIdentity *first, | 512 | const struct GNUNET_PeerIdentity *first, |
331 | const struct GNUNET_PeerIdentity *second, | 513 | const struct GNUNET_PeerIdentity *second, |
@@ -342,6 +524,15 @@ void daemon_connect_cb(void *cls, | |||
342 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected peers `%s'<->`%s' (%i/%i)\n", firstc, secondc, connected, peers-1); | 524 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected peers `%s'<->`%s' (%i/%i)\n", firstc, secondc, connected, peers-1); |
343 | GNUNET_free(firstc); | 525 | GNUNET_free(firstc); |
344 | GNUNET_free(secondc); | 526 | GNUNET_free(secondc); |
527 | |||
528 | if (((first_daemon == ping_deamon) || (second_daemon == ping_deamon)) && (master_deamon != NULL) && (ping_deamon != NULL)) | ||
529 | { | ||
530 | th = GNUNET_TRANSPORT_connect (ping_deamon->cfg,&ping_deamon->id, NULL, NULL,NULL, NULL); | ||
531 | t = NULL; | ||
532 | force_q_updates = GNUNET_YES; | ||
533 | send_msg = GNUNET_YES; | ||
534 | send_task = GNUNET_SCHEDULER_add_now(&send_task_f, NULL); | ||
535 | } | ||
345 | } | 536 | } |
346 | 537 | ||
347 | void cont_cb (void *cls, int success) | 538 | void cont_cb (void *cls, int success) |
@@ -390,7 +581,13 @@ daemon_start_cb (void *cls, | |||
390 | 581 | ||
391 | if (peers_left == 0) | 582 | if (peers_left == 0) |
392 | { | 583 | { |
393 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 584 | if (ping_deamon == NULL) |
585 | { | ||
586 | ping_deamon = d; | ||
587 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ping peer `%s' '%s'\n", GNUNET_i2s(id), d->cfgfile); | ||
588 | } | ||
589 | |||
590 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
394 | "All peers started successfully!\n"); | 591 | "All peers started successfully!\n"); |
395 | connect_peers(); | 592 | connect_peers(); |
396 | ok = 0; | 593 | ok = 0; |
@@ -449,6 +646,11 @@ check () | |||
449 | int | 646 | int |
450 | main (int argc, char *argv[]) | 647 | main (int argc, char *argv[]) |
451 | { | 648 | { |
649 | #if !HAVE_LIBGLPK | ||
650 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "GLPK not installed, exiting testcase\n"); | ||
651 | return 0; | ||
652 | #endif | ||
653 | |||
452 | int ret; | 654 | int ret; |
453 | 655 | ||
454 | GNUNET_log_setup ("test-transport-ats", | 656 | GNUNET_log_setup ("test-transport-ats", |