[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r16674 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r16674 - gnunet/src/dht |
Date: |
Thu, 1 Sep 2011 17:06:24 +0200 |
Author: grothoff
Date: 2011-09-01 17:06:23 +0200 (Thu, 01 Sep 2011)
New Revision: 16674
Modified:
gnunet/src/dht/test_dht_api.c
gnunet/src/dht/test_dht_multipeer.c
gnunet/src/dht/test_dht_twopeer.c
Log:
fixing double-adding of the 'die-task'
Modified: gnunet/src/dht/test_dht_api.c
===================================================================
--- gnunet/src/dht/test_dht_api.c 2011-09-01 15:04:29 UTC (rev 16673)
+++ gnunet/src/dht/test_dht_api.c 2011-09-01 15:06:23 UTC (rev 16674)
@@ -96,7 +96,7 @@
static int ok;
-GNUNET_SCHEDULER_TaskIdentifier die_task;
+static GNUNET_SCHEDULER_TaskIdentifier die_task;
#if VERBOSE
#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok,
__FILE__, __LINE__); } while (0)
@@ -173,7 +173,7 @@
{
GNUNET_break (0);
GNUNET_SCHEDULER_cancel (die_task);
- GNUNET_SCHEDULER_add_now (&end_badly, NULL);
+ die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
return;
}
@@ -279,7 +279,7 @@
{
GNUNET_break (0);
GNUNET_SCHEDULER_cancel (die_task);
- GNUNET_SCHEDULER_add_now (&end_badly, &p1);
+ die_task = GNUNET_SCHEDULER_add_now (&end_badly, &p1);
return;
}
retry_ctx->retry_task =
@@ -339,7 +339,7 @@
{
GNUNET_break (0);
GNUNET_SCHEDULER_cancel (die_task);
- GNUNET_SCHEDULER_add_now (&end_badly, &p1);
+ die_task = GNUNET_SCHEDULER_add_now (&end_badly, &p1);
return;
}
retry_context.retry_task =
@@ -363,7 +363,7 @@
{
GNUNET_break (0);
GNUNET_SCHEDULER_cancel (die_task);
- GNUNET_SCHEDULER_add_now (&end_badly, NULL);
+ die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
return;
}
GNUNET_assert (peer->dht_handle != NULL);
@@ -416,7 +416,7 @@
{
GNUNET_break (0);
GNUNET_SCHEDULER_cancel (die_task);
- GNUNET_SCHEDULER_add_now (&end_badly, &p1);
+ die_task = GNUNET_SCHEDULER_add_now (&end_badly, &p1);
return;
}
Modified: gnunet/src/dht/test_dht_multipeer.c
===================================================================
--- gnunet/src/dht/test_dht_multipeer.c 2011-09-01 15:04:29 UTC (rev 16673)
+++ gnunet/src/dht/test_dht_multipeer.c 2011-09-01 15:06:23 UTC (rev 16674)
@@ -211,7 +211,7 @@
enum GNUNET_DHT_RouteOption route_option;
/* Task handle to use to schedule test failure */
-GNUNET_SCHEDULER_TaskIdentifier die_task;
+static GNUNET_SCHEDULER_TaskIdentifier die_task;
static char *blacklist_transports;
@@ -347,12 +347,13 @@
{
GNUNET_SCHEDULER_cancel (die_task);
//GNUNET_SCHEDULER_add_delayed
(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5), &get_topology,
NULL);
- GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
+ die_task = GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
}
else if ((gets_completed + gets_failed == num_gets) && (outstanding_gets ==
0)) /* Had some failures */
{
GNUNET_SCHEDULER_cancel (die_task);
- GNUNET_SCHEDULER_add_now (&end_badly, "not all gets succeeded!\n");
+ die_task =
+ GNUNET_SCHEDULER_add_now (&end_badly, "not all gets succeeded!\n");
}
}
@@ -645,7 +646,6 @@
die_task =
GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
"from setup puts/gets");
-
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 2),
&setup_puts_and_gets, NULL);
@@ -685,7 +685,6 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"All %d daemons started, now connecting peers!\n", num_peers);
#endif
- GNUNET_SCHEDULER_cancel (die_task);
expected_connections = -1;
if ((pg != NULL) && (peers_left == 0))
@@ -701,17 +700,19 @@
#endif
}
+ GNUNET_SCHEDULER_cancel (die_task);
if (expected_connections == GNUNET_SYSERR)
{
die_task =
GNUNET_SCHEDULER_add_now (&end_badly,
"from connect topology (bad return)");
}
-
- die_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
- "from connect topology (timeout)");
-
+ else
+ {
+ die_task =
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
+ "from connect topology (timeout)");
+ }
ok = 0;
}
}
@@ -720,6 +721,7 @@
create_topology ()
{
peers_left = num_peers; /* Reset counter */
+ GNUNET_SCHEDULER_cancel (die_task);
if (GNUNET_TESTING_create_topology
(pg, topology, blacklist_topology, blacklist_transports) !=
GNUNET_SYSERR)
{
@@ -728,18 +730,16 @@
"Topology set up, now starting peers!\n");
#endif
GNUNET_TESTING_daemons_continue_startup (pg);
+ die_task =
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
+ "from continue startup (timeout)");
}
else
{
- GNUNET_SCHEDULER_cancel (die_task);
die_task =
GNUNET_SCHEDULER_add_now (&end_badly,
"from create topology (bad return)");
}
- GNUNET_SCHEDULER_cancel (die_task);
- die_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
- "from continue startup (timeout)");
}
/**
Modified: gnunet/src/dht/test_dht_twopeer.c
===================================================================
--- gnunet/src/dht/test_dht_twopeer.c 2011-09-01 15:04:29 UTC (rev 16673)
+++ gnunet/src/dht/test_dht_twopeer.c 2011-09-01 15:06:23 UTC (rev 16674)
@@ -72,7 +72,7 @@
static unsigned int failed_connections;
-GNUNET_SCHEDULER_TaskIdentifier die_task;
+static GNUNET_SCHEDULER_TaskIdentifier die_task;
static int ok;
@@ -105,7 +105,9 @@
GNUNET_assert (peer2dht != NULL);
GNUNET_DHT_disconnect (peer1dht);
GNUNET_DHT_disconnect (peer2dht);
+ fprintf (stderr, "Testing STOP! - finished\n");
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
+ pg = NULL;
ok = 0;
}
@@ -118,8 +120,12 @@
if (peer2dht != NULL)
GNUNET_DHT_disconnect (peer2dht);
+ fprintf (stderr, "Testing STOP - Badly!\n");
if (pg != NULL)
+ {
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
+ pg = NULL;
+ }
if (curr_get_ctx.retry_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (curr_get_ctx.retry_task);
@@ -170,7 +176,9 @@
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Key returned is not the same key as was searched for!\n");
GNUNET_SCHEDULER_cancel (die_task);
- GNUNET_SCHEDULER_add_now (&end_badly, "key mismatch in get response!\n");
+ die_task =
+ GNUNET_SCHEDULER_add_now (&end_badly,
+ "key mismatch in get response!\n");
return;
}
@@ -195,7 +203,7 @@
"Received second correct GET request response!\n");
GNUNET_SCHEDULER_cancel (die_task);
GNUNET_DHT_get_stop (get_context->get_handle);
- GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
+ die_task = GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
}
}
@@ -218,7 +226,9 @@
"Too many attempts failed, ending test!\n",
get_context->get_attempts);
GNUNET_SCHEDULER_cancel (die_task);
- GNUNET_SCHEDULER_add_now (&end_badly, "key mismatch in get response!\n");
+ die_task =
+ GNUNET_SCHEDULER_add_now (&end_badly,
+ "key mismatch in get response!\n");
return;
}
get_context->get_attempts++;
@@ -340,11 +350,10 @@
die_task =
GNUNET_SCHEDULER_add_now (&end_badly,
"from connect topology (bad return)");
-
-
- die_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
- "from connect topology (timeout)");
+ else
+ die_task =
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
+ "from connect topology (timeout)");
}
static void
@@ -366,7 +375,8 @@
if (peer1dht == NULL)
{
GNUNET_SCHEDULER_cancel (die_task);
- GNUNET_SCHEDULER_add_now (&end_badly, "Failed to get dht handle!\n");
+ die_task =
+ GNUNET_SCHEDULER_add_now (&end_badly, "Failed to get dht handle!\n");
}
}
else
@@ -376,7 +386,8 @@
if (peer2dht == NULL)
{
GNUNET_SCHEDULER_cancel (die_task);
- GNUNET_SCHEDULER_add_now (&end_badly, "Failed to get dht handle!\n");
+ die_task =
+ GNUNET_SCHEDULER_add_now (&end_badly, "Failed to get dht handle!\n");
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r16674 - gnunet/src/dht,
gnunet <=