diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-06-17 15:27:19 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-06-17 15:27:19 +0000 |
commit | 344da83a5a06b4b4db4eb68972ee49333369f2db (patch) | |
tree | 9463373acc8f042ab2e05d27746dba6c0566bced /src/dv/test_transport_api_dv.c | |
parent | 3084c1f3deba86b52b1e01fefbcf7474fe0f5d1c (diff) | |
download | gnunet-344da83a5a06b4b4db4eb68972ee49333369f2db.tar.gz gnunet-344da83a5a06b4b4db4eb68972ee49333369f2db.zip |
working distance vector transport plugin implementation. after spending days on it I think the problem (not all peers connect all the time) either lies in core, or is related to latency
Diffstat (limited to 'src/dv/test_transport_api_dv.c')
-rw-r--r-- | src/dv/test_transport_api_dv.c | 251 |
1 files changed, 215 insertions, 36 deletions
diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c index 33c1b936f..fdf3ba2df 100644 --- a/src/dv/test_transport_api_dv.c +++ b/src/dv/test_transport_api_dv.c | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | #define VERBOSE GNUNET_YES | 28 | #define VERBOSE GNUNET_YES |
29 | 29 | ||
30 | #define TEST_ALL GNUNET_NO | ||
31 | |||
30 | /** | 32 | /** |
31 | * How long until we fail the whole testcase? | 33 | * How long until we fail the whole testcase? |
32 | */ | 34 | */ |
@@ -55,6 +57,12 @@ static unsigned int total_server_connections; | |||
55 | 57 | ||
56 | static unsigned int total_messages_received; | 58 | static unsigned int total_messages_received; |
57 | 59 | ||
60 | static unsigned int total_other_expected_messages; | ||
61 | |||
62 | static unsigned int temp_total_other_messages; | ||
63 | |||
64 | static unsigned int total_other_messages; | ||
65 | |||
58 | static unsigned int expected_messages; | 66 | static unsigned int expected_messages; |
59 | 67 | ||
60 | static unsigned int expected_connections; | 68 | static unsigned int expected_connections; |
@@ -93,6 +101,8 @@ static double connect_topology_option_modifier = 0.0; | |||
93 | 101 | ||
94 | static char *test_directory; | 102 | static char *test_directory; |
95 | 103 | ||
104 | struct GNUNET_CONTAINER_MultiHashMap *peer_daemon_hash; | ||
105 | |||
96 | #define MTYPE 12345 | 106 | #define MTYPE 12345 |
97 | 107 | ||
98 | struct GNUNET_TestMessage | 108 | struct GNUNET_TestMessage |
@@ -113,6 +123,11 @@ struct PeerContext | |||
113 | /* This is a linked list */ | 123 | /* This is a linked list */ |
114 | struct PeerContext *next; | 124 | struct PeerContext *next; |
115 | 125 | ||
126 | /** | ||
127 | * Handle to the daemon | ||
128 | */ | ||
129 | struct GNUNET_TESTING_Daemon *daemon; | ||
130 | |||
116 | /* Handle to the peer core */ | 131 | /* Handle to the peer core */ |
117 | struct GNUNET_CORE_Handle *peer_handle; | 132 | struct GNUNET_CORE_Handle *peer_handle; |
118 | }; | 133 | }; |
@@ -145,6 +160,8 @@ struct TestMessageContext | |||
145 | 160 | ||
146 | static struct TestMessageContext *test_messages; | 161 | static struct TestMessageContext *test_messages; |
147 | 162 | ||
163 | static struct TestMessageContext *other_test_messages; | ||
164 | |||
148 | static void | 165 | static void |
149 | finish_testing () | 166 | finish_testing () |
150 | { | 167 | { |
@@ -153,6 +170,8 @@ finish_testing () | |||
153 | struct PeerContext *free_peer_pos; | 170 | struct PeerContext *free_peer_pos; |
154 | struct TestMessageContext *pos; | 171 | struct TestMessageContext *pos; |
155 | struct TestMessageContext *free_pos; | 172 | struct TestMessageContext *free_pos; |
173 | int count; | ||
174 | |||
156 | #if VERBOSE | 175 | #if VERBOSE |
157 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 176 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
158 | "Called finish testing, stopping daemons.\n"); | 177 | "Called finish testing, stopping daemons.\n"); |
@@ -160,15 +179,14 @@ finish_testing () | |||
160 | peer_pos = all_peers; | 179 | peer_pos = all_peers; |
161 | while (peer_pos != NULL) | 180 | while (peer_pos != NULL) |
162 | { | 181 | { |
163 | fprintf(stderr, "Disconnecting from peer core\n"); | ||
164 | if (peer_pos->peer_handle != NULL) | 182 | if (peer_pos->peer_handle != NULL) |
165 | GNUNET_CORE_disconnect(peer_pos->peer_handle); | 183 | GNUNET_CORE_disconnect(peer_pos->peer_handle); |
166 | free_peer_pos = peer_pos; | 184 | free_peer_pos = peer_pos; |
167 | peer_pos = peer_pos->next; | 185 | peer_pos = peer_pos->next; |
168 | GNUNET_free(free_peer_pos); | 186 | GNUNET_free(free_peer_pos); |
169 | } | 187 | } |
188 | all_peers = NULL; | ||
170 | 189 | ||
171 | int count; | ||
172 | count = 0; | 190 | count = 0; |
173 | pos = test_messages; | 191 | pos = test_messages; |
174 | while (pos != NULL) | 192 | while (pos != NULL) |
@@ -191,6 +209,28 @@ finish_testing () | |||
191 | } | 209 | } |
192 | GNUNET_free(free_pos); | 210 | GNUNET_free(free_pos); |
193 | } | 211 | } |
212 | |||
213 | pos = other_test_messages; | ||
214 | while (pos != NULL) | ||
215 | { | ||
216 | if (pos->peer1handle != NULL) | ||
217 | { | ||
218 | GNUNET_CORE_disconnect(pos->peer1handle); | ||
219 | pos->peer1handle = NULL; | ||
220 | } | ||
221 | if (pos->peer2handle != NULL) | ||
222 | { | ||
223 | GNUNET_CORE_disconnect(pos->peer2handle); | ||
224 | pos->peer2handle = NULL; | ||
225 | } | ||
226 | free_pos = pos; | ||
227 | pos = pos->next; | ||
228 | if (free_pos->disconnect_task != GNUNET_SCHEDULER_NO_TASK) | ||
229 | { | ||
230 | GNUNET_SCHEDULER_cancel(sched, free_pos->disconnect_task); | ||
231 | } | ||
232 | GNUNET_free(free_pos); | ||
233 | } | ||
194 | #if VERBOSE | 234 | #if VERBOSE |
195 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 235 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
196 | "transmit_ready's scheduled %d, failed %d, transmit_ready's called %d\n", transmit_ready_scheduled, transmit_ready_failed, transmit_ready_called); | 236 | "transmit_ready's scheduled %d, failed %d, transmit_ready's called %d\n", transmit_ready_scheduled, transmit_ready_failed, transmit_ready_called); |
@@ -242,10 +282,7 @@ disconnect_cores (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
242 | } | 282 | } |
243 | 283 | ||
244 | static void | 284 | static void |
245 | send_other_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | 285 | send_other_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc); |
246 | { | ||
247 | die_task = GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 25), &finish_testing, NULL); | ||
248 | } | ||
249 | 286 | ||
250 | static int | 287 | static int |
251 | process_mtype (void *cls, | 288 | process_mtype (void *cls, |
@@ -259,18 +296,36 @@ process_mtype (void *cls, | |||
259 | if (pos->uid != ntohl(msg->uid)) | 296 | if (pos->uid != ntohl(msg->uid)) |
260 | return GNUNET_OK; | 297 | return GNUNET_OK; |
261 | 298 | ||
262 | total_messages_received++; | 299 | if (total_other_expected_messages == 0) |
300 | { | ||
301 | total_messages_received++; | ||
263 | #if VERBOSE | 302 | #if VERBOSE |
264 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 303 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
265 | "Received message from `%4s', type %d, distance %u.\n", GNUNET_i2s (peer), ntohs(message->type), distance); | 304 | "Received message from `%4s', type %d, distance %u.\n", GNUNET_i2s (peer), ntohs(message->type), distance); |
266 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 305 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
267 | "Total messages received %d, expected %d.\n", total_messages_received, expected_messages); | 306 | "Total messages received %d, expected %d.\n", total_messages_received, expected_messages); |
307 | #endif | ||
308 | } | ||
309 | else | ||
310 | { | ||
311 | total_other_messages++; | ||
312 | #if VERBOSE | ||
313 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
314 | "Received message from `%4s', type %d, distance %u.\n", GNUNET_i2s (peer), ntohs(message->type), distance); | ||
315 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
316 | "Total messages received %d, expected %d.\n", total_other_messages, total_other_expected_messages); | ||
268 | #endif | 317 | #endif |
318 | } | ||
269 | 319 | ||
270 | if (total_messages_received == expected_messages) | 320 | if ((total_messages_received == expected_messages) && (total_other_messages == 0)) |
271 | { | 321 | { |
272 | GNUNET_SCHEDULER_cancel (sched, die_task); | 322 | GNUNET_SCHEDULER_cancel (sched, die_task); |
273 | GNUNET_SCHEDULER_add_now (sched, &send_other_messages, NULL); | 323 | GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 40), &send_other_messages, NULL); |
324 | } | ||
325 | else if ((total_other_expected_messages > 0) && (total_other_messages == total_other_expected_messages)) | ||
326 | { | ||
327 | GNUNET_SCHEDULER_cancel (sched, die_task); | ||
328 | GNUNET_SCHEDULER_add_now (sched, &finish_testing, NULL); | ||
274 | } | 329 | } |
275 | else | 330 | else |
276 | { | 331 | { |
@@ -288,6 +343,19 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
288 | "End badly was called (%s)... stopping daemons.\n", msg); | 343 | "End badly was called (%s)... stopping daemons.\n", msg); |
289 | struct TestMessageContext *pos; | 344 | struct TestMessageContext *pos; |
290 | struct TestMessageContext *free_pos; | 345 | struct TestMessageContext *free_pos; |
346 | struct PeerContext * peer_pos; | ||
347 | struct PeerContext * free_peer_pos; | ||
348 | |||
349 | peer_pos = all_peers; | ||
350 | while (peer_pos != NULL) | ||
351 | { | ||
352 | if (peer_pos->peer_handle != NULL) | ||
353 | GNUNET_CORE_disconnect(peer_pos->peer_handle); | ||
354 | free_peer_pos = peer_pos; | ||
355 | peer_pos = peer_pos->next; | ||
356 | GNUNET_free(free_peer_pos); | ||
357 | } | ||
358 | all_peers = NULL; | ||
291 | 359 | ||
292 | pos = test_messages; | 360 | pos = test_messages; |
293 | while (pos != NULL) | 361 | while (pos != NULL) |
@@ -307,6 +375,28 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
307 | GNUNET_free(free_pos); | 375 | GNUNET_free(free_pos); |
308 | } | 376 | } |
309 | 377 | ||
378 | pos = other_test_messages; | ||
379 | while (pos != NULL) | ||
380 | { | ||
381 | if (pos->peer1handle != NULL) | ||
382 | { | ||
383 | GNUNET_CORE_disconnect(pos->peer1handle); | ||
384 | pos->peer1handle = NULL; | ||
385 | } | ||
386 | if (pos->peer2handle != NULL) | ||
387 | { | ||
388 | GNUNET_CORE_disconnect(pos->peer2handle); | ||
389 | pos->peer2handle = NULL; | ||
390 | } | ||
391 | free_pos = pos; | ||
392 | pos = pos->next; | ||
393 | if (free_pos->disconnect_task != GNUNET_SCHEDULER_NO_TASK) | ||
394 | { | ||
395 | GNUNET_SCHEDULER_cancel(sched, free_pos->disconnect_task); | ||
396 | } | ||
397 | GNUNET_free(free_pos); | ||
398 | } | ||
399 | |||
310 | if (pg != NULL) | 400 | if (pg != NULL) |
311 | { | 401 | { |
312 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT); | 402 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT); |
@@ -437,7 +527,9 @@ send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
437 | &send_test_messages, pos); | 527 | &send_test_messages, pos); |
438 | return; /* Otherwise we'll double schedule messages here! */ | 528 | return; /* Otherwise we'll double schedule messages here! */ |
439 | } | 529 | } |
440 | 530 | #if VERBOSE | |
531 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Attempting to send test message from %s to %s\n", pos->peer1->shortname, pos->peer2->shortname); | ||
532 | #endif | ||
441 | /* | 533 | /* |
442 | * Connect to the sending peer | 534 | * Connect to the sending peer |
443 | */ | 535 | */ |
@@ -465,6 +557,77 @@ send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
465 | } | 557 | } |
466 | } | 558 | } |
467 | 559 | ||
560 | static void | ||
561 | send_other_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | ||
562 | { | ||
563 | struct TestMessageContext *pos; | ||
564 | struct TestMessageContext *free_pos; | ||
565 | struct PeerContext *peer_pos; | ||
566 | #if TEST_ALL | ||
567 | struct PeerContext *inner_peer_pos; | ||
568 | struct TestMessageContext *temp_context; | ||
569 | #endif | ||
570 | peer_pos = all_peers; | ||
571 | while (peer_pos != NULL) | ||
572 | { | ||
573 | if (peer_pos->peer_handle != NULL) | ||
574 | { | ||
575 | GNUNET_CORE_disconnect(peer_pos->peer_handle); | ||
576 | peer_pos->peer_handle = NULL; | ||
577 | } | ||
578 | #if TEST_ALL | ||
579 | inner_peer_pos = all_peers; | ||
580 | while (inner_peer_pos != NULL) | ||
581 | { | ||
582 | if (inner_peer_pos != peer_pos) | ||
583 | { | ||
584 | temp_total_other_messages++; | ||
585 | temp_context = GNUNET_malloc(sizeof(struct TestMessageContext)); | ||
586 | temp_context->peer1 = peer_pos->daemon; | ||
587 | temp_context->peer2 = inner_peer_pos->daemon; | ||
588 | temp_context->next = other_test_messages; | ||
589 | temp_context->uid = total_connections + temp_total_other_messages; | ||
590 | temp_context->disconnect_task = GNUNET_SCHEDULER_NO_TASK; | ||
591 | other_test_messages = temp_context; | ||
592 | } | ||
593 | inner_peer_pos = inner_peer_pos->next; | ||
594 | } | ||
595 | #endif | ||
596 | peer_pos = peer_pos->next; | ||
597 | } | ||
598 | all_peers = NULL; | ||
599 | |||
600 | pos = test_messages; | ||
601 | while (pos != NULL) | ||
602 | { | ||
603 | if (pos->peer1handle != NULL) | ||
604 | { | ||
605 | GNUNET_CORE_disconnect(pos->peer1handle); | ||
606 | pos->peer1handle = NULL; | ||
607 | } | ||
608 | if (pos->peer2handle != NULL) | ||
609 | { | ||
610 | GNUNET_CORE_disconnect(pos->peer2handle); | ||
611 | pos->peer2handle = NULL; | ||
612 | } | ||
613 | free_pos = pos; | ||
614 | pos = pos->next; | ||
615 | if (free_pos->disconnect_task != GNUNET_SCHEDULER_NO_TASK) | ||
616 | { | ||
617 | GNUNET_SCHEDULER_cancel(sched, free_pos->disconnect_task); | ||
618 | } | ||
619 | GNUNET_free(free_pos); | ||
620 | } | ||
621 | test_messages = NULL; | ||
622 | |||
623 | total_other_expected_messages = temp_total_other_messages; | ||
624 | #if VERBOSE | ||
625 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Preparing to send %d other test messages\n", total_other_expected_messages); | ||
626 | #endif | ||
627 | |||
628 | GNUNET_SCHEDULER_add_now (sched, &send_test_messages, other_test_messages); | ||
629 | die_task = GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 250), &end_badly, "from send_other_messages"); | ||
630 | } | ||
468 | 631 | ||
469 | void | 632 | void |
470 | topology_callback (void *cls, | 633 | topology_callback (void *cls, |
@@ -496,16 +659,7 @@ topology_callback (void *cls, | |||
496 | test_messages = temp_context; | 659 | test_messages = temp_context; |
497 | 660 | ||
498 | expected_messages++; | 661 | expected_messages++; |
499 | /*if (dotOutFile != NULL) | 662 | |
500 | { | ||
501 | if (distance == 1) | ||
502 | fprintf(dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname, second_daemon->shortname); | ||
503 | else if (distance == 2) | ||
504 | fprintf(dotOutFile, "\tn%s -- n%s [color=blue];\n", first_daemon->shortname, second_daemon->shortname); | ||
505 | else if (distance == 3) | ||
506 | fprintf(dotOutFile, "\tn%s -- n%s [color=red];\n", first_daemon->shortname, second_daemon->shortname); | ||
507 | } | ||
508 | */ | ||
509 | } | 663 | } |
510 | #if VERBOSE | 664 | #if VERBOSE |
511 | else | 665 | else |
@@ -620,21 +774,39 @@ static void all_connect_handler (void *cls, | |||
620 | uint32_t distance) | 774 | uint32_t distance) |
621 | { | 775 | { |
622 | struct GNUNET_TESTING_Daemon *d = cls; | 776 | struct GNUNET_TESTING_Daemon *d = cls; |
777 | struct GNUNET_TESTING_Daemon *second_daemon; | ||
623 | char *second_shortname = strdup(GNUNET_i2s(peer)); | 778 | char *second_shortname = strdup(GNUNET_i2s(peer)); |
624 | 779 | #if !TEST_ALL | |
780 | struct TestMessageContext *temp_context; | ||
781 | #endif | ||
625 | #if VERBOSE | 782 | #if VERBOSE |
626 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "connected peer %s to peer %s, distance %u\n", | 783 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "connected peer %s to peer %s, distance %u\n", |
627 | d->shortname, | 784 | d->shortname, |
628 | second_shortname, | 785 | second_shortname, |
629 | distance); | 786 | distance); |
630 | #endif | 787 | #endif |
631 | /*temp_context = GNUNET_malloc(sizeof(struct TestMessageContext)); | 788 | |
632 | temp_context->peer1 = first_daemon; | 789 | second_daemon = GNUNET_CONTAINER_multihashmap_get(peer_daemon_hash, &peer->hashPubKey); |
633 | temp_context->peer2 = second_daemon; | 790 | |
634 | temp_context->next = test_messages; | 791 | if (second_daemon == NULL) |
635 | temp_context->uid = total_connections; | 792 | { |
636 | temp_context->disconnect_task = GNUNET_SCHEDULER_NO_TASK; | 793 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Couldn't find second peer!\n"); |
637 | test_messages = temp_context;*/ | 794 | return; |
795 | } | ||
796 | #if !TEST_ALL | ||
797 | if (distance > 1) | ||
798 | { | ||
799 | temp_total_other_messages++; | ||
800 | temp_context = GNUNET_malloc(sizeof(struct TestMessageContext)); | ||
801 | temp_context->peer1 = d; | ||
802 | temp_context->peer2 = second_daemon; | ||
803 | temp_context->next = other_test_messages; | ||
804 | temp_context->uid = total_connections; | ||
805 | temp_context->disconnect_task = GNUNET_SCHEDULER_NO_TASK; | ||
806 | other_test_messages = temp_context; | ||
807 | } | ||
808 | #endif | ||
809 | |||
638 | 810 | ||
639 | if (dotOutFile != NULL) | 811 | if (dotOutFile != NULL) |
640 | { | 812 | { |
@@ -644,6 +816,8 @@ static void all_connect_handler (void *cls, | |||
644 | fprintf(dotOutFile, "\tn%s -- n%s [color=blue];\n", d->shortname, second_shortname); | 816 | fprintf(dotOutFile, "\tn%s -- n%s [color=blue];\n", d->shortname, second_shortname); |
645 | else if (distance == 3) | 817 | else if (distance == 3) |
646 | fprintf(dotOutFile, "\tn%s -- n%s [color=red];\n", d->shortname, second_shortname); | 818 | fprintf(dotOutFile, "\tn%s -- n%s [color=red];\n", d->shortname, second_shortname); |
819 | else if (distance == 4) | ||
820 | fprintf(dotOutFile, "\tn%s -- n%s [color=green];\n", d->shortname, second_shortname); | ||
647 | } | 821 | } |
648 | GNUNET_free(second_shortname); | 822 | GNUNET_free(second_shortname); |
649 | } | 823 | } |
@@ -666,8 +840,11 @@ peers_started_callback (void *cls, | |||
666 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n", | 840 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n", |
667 | (num_peers - peers_left) + 1, num_peers); | 841 | (num_peers - peers_left) + 1, num_peers); |
668 | #endif | 842 | #endif |
843 | GNUNET_assert(GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap_put(peer_daemon_hash, &id->hashPubKey, d, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
844 | |||
669 | new_peer = GNUNET_malloc(sizeof(struct PeerContext)); | 845 | new_peer = GNUNET_malloc(sizeof(struct PeerContext)); |
670 | new_peer->peer_handle = GNUNET_CORE_connect(sched, cfg, GNUNET_TIME_UNIT_FOREVER_REL, d, NULL, &all_connect_handler, NULL, NULL, GNUNET_NO, NULL, GNUNET_NO, no_handlers); | 846 | new_peer->peer_handle = GNUNET_CORE_connect(sched, cfg, GNUNET_TIME_UNIT_FOREVER_REL, d, NULL, &all_connect_handler, NULL, NULL, GNUNET_NO, NULL, GNUNET_NO, no_handlers); |
847 | new_peer->daemon = d; | ||
671 | new_peer->next = all_peers; | 848 | new_peer->next = all_peers; |
672 | all_peers = new_peer; | 849 | all_peers = new_peer; |
673 | peers_left--; | 850 | peers_left--; |
@@ -782,7 +959,7 @@ run (void *cls, | |||
782 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 959 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
783 | "Invalid connect topology `%s' given for section %s option %s\n", connect_topology_str, "TESTING", "CONNECT_TOPOLOGY"); | 960 | "Invalid connect topology `%s' given for section %s option %s\n", connect_topology_str, "TESTING", "CONNECT_TOPOLOGY"); |
784 | } | 961 | } |
785 | 962 | GNUNET_free_non_null(connect_topology_str); | |
786 | if ((GNUNET_YES == | 963 | if ((GNUNET_YES == |
787 | GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "connect_topology_option", | 964 | GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "connect_topology_option", |
788 | &connect_topology_option_str)) && (GNUNET_NO == GNUNET_TESTING_topology_option_get(&connect_topology_option, connect_topology_option_str))) | 965 | &connect_topology_option_str)) && (GNUNET_NO == GNUNET_TESTING_topology_option_get(&connect_topology_option, connect_topology_option_str))) |
@@ -791,7 +968,7 @@ run (void *cls, | |||
791 | "Invalid connect topology option `%s' given for section %s option %s\n", connect_topology_option_str, "TESTING", "CONNECT_TOPOLOGY_OPTION"); | 968 | "Invalid connect topology option `%s' given for section %s option %s\n", connect_topology_option_str, "TESTING", "CONNECT_TOPOLOGY_OPTION"); |
792 | connect_topology_option = GNUNET_TESTING_TOPOLOGY_OPTION_ALL; /* Defaults to NONE, set to ALL */ | 969 | connect_topology_option = GNUNET_TESTING_TOPOLOGY_OPTION_ALL; /* Defaults to NONE, set to ALL */ |
793 | } | 970 | } |
794 | 971 | GNUNET_free_non_null(connect_topology_option_str); | |
795 | if (GNUNET_YES == | 972 | if (GNUNET_YES == |
796 | GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "connect_topology_option_modifier", | 973 | GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "connect_topology_option_modifier", |
797 | &connect_topology_option_modifier_string)) | 974 | &connect_topology_option_modifier_string)) |
@@ -813,12 +990,13 @@ run (void *cls, | |||
813 | 990 | ||
814 | if ((GNUNET_YES == | 991 | if ((GNUNET_YES == |
815 | GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "blacklist_topology", | 992 | GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "blacklist_topology", |
816 | & blacklist_topology_str)) && (GNUNET_NO == GNUNET_TESTING_topology_get(&blacklist_topology, blacklist_topology_str))) | 993 | &blacklist_topology_str)) && (GNUNET_NO == GNUNET_TESTING_topology_get(&blacklist_topology, blacklist_topology_str))) |
817 | { | 994 | { |
818 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 995 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
819 | "Invalid topology `%s' given for section %s option %s\n", topology_str, "TESTING", "BLACKLIST_TOPOLOGY"); | 996 | "Invalid topology `%s' given for section %s option %s\n", topology_str, "TESTING", "BLACKLIST_TOPOLOGY"); |
820 | } | 997 | } |
821 | 998 | GNUNET_free_non_null(topology_str); | |
999 | GNUNET_free_non_null(blacklist_topology_str); | ||
822 | if (GNUNET_SYSERR == | 1000 | if (GNUNET_SYSERR == |
823 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers", | 1001 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers", |
824 | &num_peers)) | 1002 | &num_peers)) |
@@ -834,6 +1012,7 @@ run (void *cls, | |||
834 | (GNUNET_TIME_UNIT_MINUTES, 5), | 1012 | (GNUNET_TIME_UNIT_MINUTES, 5), |
835 | &end_badly, "didn't start all daemons in reasonable amount of time!!!"); | 1013 | &end_badly, "didn't start all daemons in reasonable amount of time!!!"); |
836 | 1014 | ||
1015 | peer_daemon_hash = GNUNET_CONTAINER_multihashmap_create(peers_left); | ||
837 | pg = GNUNET_TESTING_daemons_start (sched, cfg, | 1016 | pg = GNUNET_TESTING_daemons_start (sched, cfg, |
838 | peers_left, TIMEOUT, &hostkey_callback, NULL, &peers_started_callback, NULL, | 1017 | peers_left, TIMEOUT, &hostkey_callback, NULL, &peers_started_callback, NULL, |
839 | &topology_callback, NULL, NULL); | 1018 | &topology_callback, NULL, NULL); |