diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-04-28 12:58:35 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-04-28 12:58:35 +0000 |
commit | a31eacdf89f2c932704cefb6498264895db01eab (patch) | |
tree | 8c3e57361d6634936304909ae95ceebda60c8be9 /src/testing/test_testing_topology.c | |
parent | d83a3d2ac2a33d43239bbd5703574872081ba81f (diff) | |
download | gnunet-a31eacdf89f2c932704cefb6498264895db01eab.tar.gz gnunet-a31eacdf89f2c932704cefb6498264895db01eab.zip |
testing bugfix, add scale free topology
Diffstat (limited to 'src/testing/test_testing_topology.c')
-rw-r--r-- | src/testing/test_testing_topology.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index 6961f0418..2006cc468 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c | |||
@@ -116,6 +116,9 @@ struct TestMessageContext | |||
116 | /* Identifier for this message, so we don't disconnect other peers! */ | 116 | /* Identifier for this message, so we don't disconnect other peers! */ |
117 | uint32_t uid; | 117 | uint32_t uid; |
118 | 118 | ||
119 | /* Task for disconnecting cores, allow task to be cancelled on shutdown */ | ||
120 | GNUNET_SCHEDULER_TaskIdentifier disconnect_task; | ||
121 | |||
119 | }; | 122 | }; |
120 | 123 | ||
121 | static struct TestMessageContext *test_messages; | 124 | static struct TestMessageContext *test_messages; |
@@ -147,6 +150,10 @@ finish_testing () | |||
147 | } | 150 | } |
148 | free_pos = pos; | 151 | free_pos = pos; |
149 | pos = pos->next; | 152 | pos = pos->next; |
153 | if (free_pos->disconnect_task != GNUNET_SCHEDULER_NO_TASK) | ||
154 | { | ||
155 | GNUNET_SCHEDULER_cancel(sched, free_pos->disconnect_task); | ||
156 | } | ||
150 | GNUNET_free(free_pos); | 157 | GNUNET_free(free_pos); |
151 | } | 158 | } |
152 | #if VERBOSE | 159 | #if VERBOSE |
@@ -194,6 +201,7 @@ disconnect_cores (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
194 | /* Set handles to NULL so test case can be ended properly */ | 201 | /* Set handles to NULL so test case can be ended properly */ |
195 | pos->peer1handle = NULL; | 202 | pos->peer1handle = NULL; |
196 | pos->peer2handle = NULL; | 203 | pos->peer2handle = NULL; |
204 | pos->disconnect_task = GNUNET_SCHEDULER_NO_TASK; | ||
197 | /* Decrement total connections so new can be established */ | 205 | /* Decrement total connections so new can be established */ |
198 | total_server_connections -= 2; | 206 | total_server_connections -= 2; |
199 | } | 207 | } |
@@ -225,7 +233,7 @@ process_mtype (void *cls, | |||
225 | } | 233 | } |
226 | else | 234 | else |
227 | { | 235 | { |
228 | GNUNET_SCHEDULER_add_now(sched, &disconnect_cores, pos); | 236 | pos->disconnect_task = GNUNET_SCHEDULER_add_now(sched, &disconnect_cores, pos); |
229 | } | 237 | } |
230 | 238 | ||
231 | return GNUNET_OK; | 239 | return GNUNET_OK; |
@@ -443,6 +451,7 @@ topology_callback (void *cls, | |||
443 | temp_context->peer2 = second_daemon; | 451 | temp_context->peer2 = second_daemon; |
444 | temp_context->next = test_messages; | 452 | temp_context->next = test_messages; |
445 | temp_context->uid = total_connections; | 453 | temp_context->uid = total_connections; |
454 | temp_context->disconnect_task = GNUNET_SCHEDULER_NO_TASK; | ||
446 | test_messages = temp_context; | 455 | test_messages = temp_context; |
447 | 456 | ||
448 | expected_messages++; | 457 | expected_messages++; |