aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-11-26 13:52:44 +0000
committerChristian Grothoff <christian@grothoff.org>2011-11-26 13:52:44 +0000
commitf362c54ec70a357f847e1bb6cfa92e9535bdde32 (patch)
tree30f9a0606a79049c33a42dadb0cc877dd9c11036
parentfe6168bdc4c414b5a5c435c9ea04586120cd3ed3 (diff)
downloadgnunet-f362c54ec70a357f847e1bb6cfa92e9535bdde32.tar.gz
gnunet-f362c54ec70a357f847e1bb6cfa92e9535bdde32.zip
LRN: Fix dht multipeer testing crash - #1919
-rw-r--r--src/testing/testing_group.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index db763d22a..f22bb2bff 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -550,6 +550,12 @@ struct PeerData
550 * stagger hostkey generation and peer startup. 550 * stagger hostkey generation and peer startup.
551 */ 551 */
552 struct InternalStartContext internal_context; 552 struct InternalStartContext internal_context;
553
554 /**
555 * Task ID for the queued internal_continue_startup task
556 */
557 GNUNET_SCHEDULER_TaskIdentifier startup_task;
558
553}; 559};
554 560
555/** 561/**
@@ -5557,6 +5563,7 @@ internal_continue_startup (void *cls,
5557 const struct GNUNET_SCHEDULER_TaskContext *tc) 5563 const struct GNUNET_SCHEDULER_TaskContext *tc)
5558{ 5564{
5559 struct InternalStartContext *internal_context = cls; 5565 struct InternalStartContext *internal_context = cls;
5566 internal_context->peer->startup_task = GNUNET_SCHEDULER_NO_TASK;
5560 5567
5561 if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) 5568 if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
5562 { 5569 {
@@ -5579,7 +5586,7 @@ internal_continue_startup (void *cls,
5579 } 5586 }
5580 else 5587 else
5581 { 5588 {
5582 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 5589 internal_context->peer->startup_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
5583 (GNUNET_TIME_UNIT_MILLISECONDS, 100), 5590 (GNUNET_TIME_UNIT_MILLISECONDS, 100),
5584 &internal_continue_startup, internal_context); 5591 &internal_continue_startup, internal_context);
5585 } 5592 }
@@ -5887,7 +5894,7 @@ GNUNET_TESTING_daemons_continue_startup (struct GNUNET_TESTING_PeerGroup *pg)
5887 pg->starting = 0; 5894 pg->starting = 0;
5888 for (i = 0; i < pg->total; i++) 5895 for (i = 0; i < pg->total; i++)
5889 { 5896 {
5890 GNUNET_SCHEDULER_add_now (&internal_continue_startup, 5897 pg->peers[i].startup_task = GNUNET_SCHEDULER_add_now (&internal_continue_startup,
5891 &pg->peers[i].internal_context); 5898 &pg->peers[i].internal_context);
5892 } 5899 }
5893 } 5900 }
@@ -5895,7 +5902,7 @@ GNUNET_TESTING_daemons_continue_startup (struct GNUNET_TESTING_PeerGroup *pg)
5895 pg->starting = 0; 5902 pg->starting = 0;
5896 for (i = 0; i < pg->total; i++) 5903 for (i = 0; i < pg->total; i++)
5897 { 5904 {
5898 GNUNET_SCHEDULER_add_now (&internal_continue_startup, 5905 pg->peers[i].startup_task = GNUNET_SCHEDULER_add_now (&internal_continue_startup,
5899 &pg->peers[i].internal_context); 5906 &pg->peers[i].internal_context);
5900 } 5907 }
5901#endif 5908#endif
@@ -6903,6 +6910,7 @@ internal_shutdown_callback (void *cls, const char *emsg)
6903 struct PeerShutdownContext *peer_shutdown_ctx = cls; 6910 struct PeerShutdownContext *peer_shutdown_ctx = cls;
6904 struct ShutdownContext *shutdown_ctx = peer_shutdown_ctx->shutdown_ctx; 6911 struct ShutdownContext *shutdown_ctx = peer_shutdown_ctx->shutdown_ctx;
6905 unsigned int off; 6912 unsigned int off;
6913 int i;
6906 struct OutstandingSSH *ssh_pos; 6914 struct OutstandingSSH *ssh_pos;
6907 6915
6908 shutdown_ctx->outstanding--; 6916 shutdown_ctx->outstanding--;
@@ -6933,6 +6941,11 @@ internal_shutdown_callback (void *cls, const char *emsg)
6933 else 6941 else
6934 shutdown_ctx->cb (shutdown_ctx->cb_cls, NULL); 6942 shutdown_ctx->cb (shutdown_ctx->cb_cls, NULL);
6935 6943
6944 for (i = 0; i < shutdown_ctx->pg->total; i++)
6945 {
6946 if (shutdown_ctx->pg->peers[i].startup_task != GNUNET_SCHEDULER_NO_TASK)
6947 GNUNET_SCHEDULER_cancel (shutdown_ctx->pg->peers[i].startup_task);
6948 }
6936 GNUNET_free (shutdown_ctx->pg->peers); 6949 GNUNET_free (shutdown_ctx->pg->peers);
6937 GNUNET_free_non_null (shutdown_ctx->pg->hostkey_data); 6950 GNUNET_free_non_null (shutdown_ctx->pg->hostkey_data);
6938 for (off = 0; off < shutdown_ctx->pg->num_hosts; off++) 6951 for (off = 0; off < shutdown_ctx->pg->num_hosts; off++)