aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-05-18 08:17:22 +0000
committerChristian Grothoff <christian@grothoff.org>2010-05-18 08:17:22 +0000
commitd34c5bfd6feda8af67d2d27e77ca81341ea24f41 (patch)
treed1ee1fab06970daf31aeced91b2c87a3a18b8ebd /src/testing
parent958ccc2a0f95bce517efb41addb28039f9fb8b38 (diff)
downloadgnunet-d34c5bfd6feda8af67d2d27e77ca81341ea24f41.tar.gz
gnunet-d34c5bfd6feda8af67d2d27e77ca81341ea24f41.zip
fix testing
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 6d75be6a5..82abbdd97 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -1197,18 +1197,12 @@ notify_connect_result (void *cls,
1197 struct ConnectContext *ctx = cls; 1197 struct ConnectContext *ctx = cls;
1198 struct GNUNET_TIME_Relative remaining; 1198 struct GNUNET_TIME_Relative remaining;
1199 1199
1200 ctx->timeout_task = GNUNET_SCHEDULER_NO_TASK;
1200 if (ctx->hello_send_task != GNUNET_SCHEDULER_NO_TASK) 1201 if (ctx->hello_send_task != GNUNET_SCHEDULER_NO_TASK)
1201 { 1202 {
1202 GNUNET_SCHEDULER_cancel(ctx->d1->sched, ctx->hello_send_task); 1203 GNUNET_SCHEDULER_cancel(ctx->d1->sched, ctx->hello_send_task);
1203 ctx->hello_send_task = GNUNET_SCHEDULER_NO_TASK; 1204 ctx->hello_send_task = GNUNET_SCHEDULER_NO_TASK;
1204 } 1205 }
1205
1206 if ((ctx->timeout_task != GNUNET_SCHEDULER_NO_TASK) && (tc->reason != GNUNET_SCHEDULER_REASON_TIMEOUT))
1207 {
1208 GNUNET_SCHEDULER_cancel(ctx->d1->sched, ctx->timeout_task);
1209 ctx->timeout_task = GNUNET_SCHEDULER_NO_TASK;
1210 }
1211
1212 if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) 1206 if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
1213 { 1207 {
1214 if (ctx->d2th != NULL) 1208 if (ctx->d2th != NULL)
@@ -1285,10 +1279,9 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity * peer, struct GNUNE
1285 { 1279 {
1286 ctx->connected = GNUNET_YES; 1280 ctx->connected = GNUNET_YES;
1287 GNUNET_SCHEDULER_cancel(ctx->d1->sched, ctx->timeout_task); 1281 GNUNET_SCHEDULER_cancel(ctx->d1->sched, ctx->timeout_task);
1288 ctx->timeout_task = GNUNET_SCHEDULER_NO_TASK; 1282 ctx->timeout_task = GNUNET_SCHEDULER_add_now (ctx->d1->sched,
1289 GNUNET_SCHEDULER_add_now (ctx->d1->sched, 1283 &notify_connect_result,
1290 &notify_connect_result, 1284 ctx);
1291 ctx);
1292 } 1285 }
1293 1286
1294} 1287}
@@ -1298,9 +1291,9 @@ send_hello(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1298{ 1291{
1299 struct ConnectContext *ctx = cls; 1292 struct ConnectContext *ctx = cls;
1300 1293
1294 ctx->hello_send_task = GNUNET_SCHEDULER_NO_TASK;
1301 if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) 1295 if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
1302 return; 1296 return;
1303
1304 if (ctx->d1->hello != NULL) 1297 if (ctx->d1->hello != NULL)
1305 { 1298 {
1306 GNUNET_TRANSPORT_offer_hello (ctx->d2th, GNUNET_HELLO_get_header(ctx->d1->hello)); 1299 GNUNET_TRANSPORT_offer_hello (ctx->d2th, GNUNET_HELLO_get_header(ctx->d1->hello));
@@ -1397,7 +1390,8 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
1397 } 1390 }
1398 1391
1399 ctx->timeout_task = GNUNET_SCHEDULER_add_delayed (d1->sched, 1392 ctx->timeout_task = GNUNET_SCHEDULER_add_delayed (d1->sched,
1400 GNUNET_TIME_relative_divide(ctx->relative_timeout, max_connect_attempts), /* Allow up to 8 reconnect attempts */ 1393 GNUNET_TIME_relative_divide(ctx->relative_timeout,
1394 max_connect_attempts),
1401 &notify_connect_result, ctx); 1395 &notify_connect_result, ctx);
1402 1396
1403 ctx->hello_send_task = GNUNET_SCHEDULER_add_now(ctx->d1->sched, &send_hello, ctx); 1397 ctx->hello_send_task = GNUNET_SCHEDULER_add_now(ctx->d1->sched, &send_hello, ctx);