aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2011-07-25 17:52:44 +0000
committerNathan S. Evans <evans@in.tum.de>2011-07-25 17:52:44 +0000
commit23421a2a22ceeeee939c98d4f452c152ca14a954 (patch)
treeb56dec30a1d38bd815ed2ba21afbb582bccbedec /src
parente92d271512c4c65bdcbf890adfa56f43f7999a63 (diff)
downloadgnunet-23421a2a22ceeeee939c98d4f452c152ca14a954.tar.gz
gnunet-23421a2a22ceeeee939c98d4f452c152ca14a954.zip
churn fixes
Diffstat (limited to 'src')
-rw-r--r--src/testing/testing_group.c40
1 files changed, 15 insertions, 25 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index 21a486054..e928a2e79 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -5548,11 +5548,6 @@ churn_start_callback(void *cls, const struct GNUNET_PeerIdentity *id,
5548 churn_ctx->num_to_start--; 5548 churn_ctx->num_to_start--;
5549 } 5549 }
5550 5550
5551#if DEBUG_CHURN
5552 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
5553 "Started peer, %d left.\n", churn_ctx->num_to_start);
5554#endif
5555
5556 total_left = (churn_ctx->num_to_stop - churn_ctx->num_failed_stop) 5551 total_left = (churn_ctx->num_to_stop - churn_ctx->num_failed_stop)
5557 + (churn_ctx->num_to_start - churn_ctx->num_failed_start); 5552 + (churn_ctx->num_to_start - churn_ctx->num_failed_start);
5558 5553
@@ -6276,10 +6271,6 @@ churn_stop_callback(void *cls, const char *emsg)
6276 churn_ctx->num_to_stop--; 6271 churn_ctx->num_to_stop--;
6277 } 6272 }
6278 6273
6279#if DEBUG_CHURN
6280 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
6281 "Stopped peer, %d left.\n", churn_ctx->num_to_stop);
6282#endif
6283 total_left = (churn_ctx->num_to_stop - churn_ctx->num_failed_stop) 6274 total_left = (churn_ctx->num_to_stop - churn_ctx->num_failed_stop)
6284 + (churn_ctx->num_to_start - churn_ctx->num_failed_start); 6275 + (churn_ctx->num_to_start - churn_ctx->num_failed_start);
6285 6276
@@ -6446,12 +6437,15 @@ GNUNET_TESTING_daemons_churn(struct GNUNET_TESTING_PeerGroup *pg,
6446 /* FIXME: while (pos != NULL) */ 6437 /* FIXME: while (pos != NULL) */
6447 if (pos != NULL) 6438 if (pos != NULL)
6448 { 6439 {
6449 if (0 == strcasecmp(pos, service)) 6440#if FIXME
6441 if (0 == strcasecmp(pos, service))
6450 { 6442 {
6451 GNUNET_assert (stopped != -1); 6443
6452 stopped++;
6453 break; 6444 break;
6454 } 6445 }
6446#endif
6447 GNUNET_assert (stopped != -1);
6448 stopped++;
6455 /* FIXME: pos = pos->next; */ 6449 /* FIXME: pos = pos->next; */
6456 } 6450 }
6457 if (pos == NULL) 6451 if (pos == NULL)
@@ -6465,7 +6459,7 @@ GNUNET_TESTING_daemons_churn(struct GNUNET_TESTING_PeerGroup *pg,
6465 if (voff > running) 6459 if (voff > running)
6466 { 6460 {
6467 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 6461 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
6468 "Trying to stop more peers than are currently running!\n"); 6462 "Trying to stop more peers (%d) than are currently running (%d)!\n", voff, running);
6469 cb (cb_cls, "Trying to stop more peers than are currently running!"); 6463 cb (cb_cls, "Trying to stop more peers than are currently running!");
6470 return; 6464 return;
6471 } 6465 }
@@ -6473,13 +6467,15 @@ GNUNET_TESTING_daemons_churn(struct GNUNET_TESTING_PeerGroup *pg,
6473 if (von > stopped) 6467 if (von > stopped)
6474 { 6468 {
6475 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 6469 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
6476 "Trying to start more peers than are currently stopped!\n"); 6470 "Trying to start more peers (%d) than are currently stopped (%d)!\n", von, stopped);
6477 cb (cb_cls, "Trying to start more peers than are currently stopped!"); 6471 cb (cb_cls, "Trying to start more peers than are currently stopped!");
6478 return; 6472 return;
6479 } 6473 }
6480 6474
6481 churn_ctx = GNUNET_malloc (sizeof (struct ChurnContext)); 6475 churn_ctx = GNUNET_malloc (sizeof (struct ChurnContext));
6482 6476
6477 if (service != NULL)
6478 churn_ctx->service = GNUNET_strdup(service);
6483 running_arr = NULL; 6479 running_arr = NULL;
6484 if (running > 0) 6480 if (running > 0)
6485 running_arr = GNUNET_malloc (running * sizeof (unsigned int)); 6481 running_arr = GNUNET_malloc (running * sizeof (unsigned int));
@@ -6533,13 +6529,9 @@ GNUNET_TESTING_daemons_churn(struct GNUNET_TESTING_PeerGroup *pg,
6533 /* FIXME: while (pos != NULL) */ 6529 /* FIXME: while (pos != NULL) */
6534 if (pos != NULL) 6530 if (pos != NULL)
6535 { 6531 {
6536 if (0 == strcasecmp(pos, service)) 6532 GNUNET_assert ((stopped_arr != NULL) && (total_stopped > stopped));
6537 { 6533 stopped_arr[stopped] = i;
6538 GNUNET_assert ((stopped_arr != NULL) && (total_stopped > stopped)); 6534 stopped++;
6539 stopped_arr[stopped] = i;
6540 stopped++;
6541 break;
6542 }
6543 /* FIXME: pos = pos->next; */ 6535 /* FIXME: pos = pos->next; */
6544 } 6536 }
6545 if (pos == NULL) 6537 if (pos == NULL)
@@ -6564,8 +6556,7 @@ GNUNET_TESTING_daemons_churn(struct GNUNET_TESTING_PeerGroup *pg,
6564 for (i = 0; i < voff; i++) 6556 for (i = 0; i < voff; i++)
6565 { 6557 {
6566#if DEBUG_CHURN 6558#if DEBUG_CHURN
6567 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Stopping peer %d!\n", 6559 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Stopping peer %d!\n", running_arr[running_permute[i]]);
6568 running_permute[i]);
6569#endif 6560#endif
6570 GNUNET_assert (running_arr != NULL); 6561 GNUNET_assert (running_arr != NULL);
6571 peer_shutdown_ctx = GNUNET_malloc (sizeof (struct PeerShutdownContext)); 6562 peer_shutdown_ctx = GNUNET_malloc (sizeof (struct PeerShutdownContext));
@@ -6587,8 +6578,7 @@ GNUNET_TESTING_daemons_churn(struct GNUNET_TESTING_PeerGroup *pg,
6587 for (i = 0; i < von; i++) 6578 for (i = 0; i < von; i++)
6588 { 6579 {
6589#if DEBUG_CHURN 6580#if DEBUG_CHURN
6590 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Starting up peer %d!\n", 6581 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Starting up peer %d!\n", stopped_arr[stopped_permute[i]]);
6591 stopped_permute[i]);
6592#endif 6582#endif
6593 GNUNET_assert (stopped_arr != NULL); 6583 GNUNET_assert (stopped_arr != NULL);
6594 peer_restart_ctx = GNUNET_malloc (sizeof (struct PeerRestartContext)); 6584 peer_restart_ctx = GNUNET_malloc (sizeof (struct PeerRestartContext));