aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_group.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_group.c')
-rw-r--r--src/testing/testing_group.c84
1 files changed, 41 insertions, 43 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index c81373025..4ace9f055 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -893,7 +893,7 @@ struct ConnectContext
893 893
894 /** 894 /**
895 * Context in 'testing.c', to cancel connection attempt. 895 * Context in 'testing.c', to cancel connection attempt.
896 */ 896 */
897 struct GNUNET_TESTING_ConnectContext *cc; 897 struct GNUNET_TESTING_ConnectContext *cc;
898 898
899 /** 899 /**
@@ -3231,10 +3231,9 @@ preschedule_connect (struct GNUNET_TESTING_PeerGroup *pg)
3231 connect_context->first_index = random_peer; 3231 connect_context->first_index = random_peer;
3232 connect_context->second_index = connection_iter->index; 3232 connect_context->second_index = connection_iter->index;
3233 connect_context->ct_ctx = ct_ctx; 3233 connect_context->ct_ctx = ct_ctx;
3234 connect_context->task = GNUNET_SCHEDULER_add_now (&schedule_connect, connect_context); 3234 connect_context->task =
3235 GNUNET_CONTAINER_DLL_insert (pg->cc_head, 3235 GNUNET_SCHEDULER_add_now (&schedule_connect, connect_context);
3236 pg->cc_tail, 3236 GNUNET_CONTAINER_DLL_insert (pg->cc_head, pg->cc_tail, connect_context);
3237 connect_context);
3238 GNUNET_CONTAINER_DLL_remove (pg->peers[random_peer].connect_peers_head, 3237 GNUNET_CONTAINER_DLL_remove (pg->peers[random_peer].connect_peers_head,
3239 pg->peers[random_peer].connect_peers_tail, 3238 pg->peers[random_peer].connect_peers_tail,
3240 connection_iter); 3239 connection_iter);
@@ -3639,9 +3638,7 @@ internal_connect_notify (void *cls, const struct GNUNET_PeerIdentity *first,
3639 connect_ctx->cc = NULL; 3638 connect_ctx->cc = NULL;
3640 GNUNET_assert (0 < pg->outstanding_connects); 3639 GNUNET_assert (0 < pg->outstanding_connects);
3641 pg->outstanding_connects--; 3640 pg->outstanding_connects--;
3642 GNUNET_CONTAINER_DLL_remove (pg->cc_head, 3641 GNUNET_CONTAINER_DLL_remove (pg->cc_head, pg->cc_tail, connect_ctx);
3643 pg->cc_tail,
3644 connect_ctx);
3645 /* 3642 /*
3646 * Check whether the inverse connection has been scheduled yet, 3643 * Check whether the inverse connection has been scheduled yet,
3647 * if not, we can remove it from the other peers list and avoid 3644 * if not, we can remove it from the other peers list and avoid
@@ -3719,33 +3716,36 @@ schedule_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
3719 _ 3716 _
3720 ("Delaying connect, we have too many outstanding connections!\n")); 3717 ("Delaying connect, we have too many outstanding connections!\n"));
3721#endif 3718#endif
3722 connect_context->task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 3719 connect_context->task =
3723 (GNUNET_TIME_UNIT_MILLISECONDS, 100), 3720 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
3724 &schedule_connect, connect_context); 3721 (GNUNET_TIME_UNIT_MILLISECONDS, 100),
3722 &schedule_connect, connect_context);
3725 return; 3723 return;
3726 } 3724 }
3727#if VERBOSE_TESTING 3725#if VERBOSE_TESTING
3728 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3726 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3729 _ 3727 _
3730 ("Creating connection, outstanding_connections is %d (max %d)\n"), 3728 ("Creating connection, outstanding_connections is %d (max %d)\n"),
3731 pg->outstanding_connects, pg->max_outstanding_connections); 3729 pg->outstanding_connects, pg->max_outstanding_connections);
3732#endif 3730#endif
3733 pg->outstanding_connects++; 3731 pg->outstanding_connects++;
3734 pg->total_connects_scheduled++; 3732 pg->total_connects_scheduled++;
3735 GNUNET_assert (NULL == connect_context->cc); 3733 GNUNET_assert (NULL == connect_context->cc);
3736 connect_context->cc 3734 connect_context->cc =
3737 = GNUNET_TESTING_daemons_connect (pg-> 3735 GNUNET_TESTING_daemons_connect (pg->
3738 peers[connect_context->first_index].daemon, 3736 peers[connect_context->
3739 pg->peers[connect_context-> 3737 first_index].daemon,
3740 second_index].daemon, 3738 pg->peers[connect_context->
3741 connect_context->ct_ctx->connect_timeout, 3739 second_index].daemon,
3742 connect_context->ct_ctx->connect_attempts, 3740 connect_context->ct_ctx->connect_timeout,
3741 connect_context->ct_ctx->connect_attempts,
3743#if USE_SEND_HELLOS 3742#if USE_SEND_HELLOS
3744 GNUNET_NO, 3743 GNUNET_NO,
3745#else 3744#else
3746 GNUNET_YES, 3745 GNUNET_YES,
3747#endif 3746#endif
3748 &internal_connect_notify, connect_context); 3747 &internal_connect_notify,
3748 connect_context);
3749 3749
3750} 3750}
3751 3751
@@ -3772,10 +3772,10 @@ connect_iterator (void *cls, const GNUNET_HashCode * key, void *value)
3772 connect_context->first = first->daemon; 3772 connect_context->first = first->daemon;
3773 connect_context->second = second; 3773 connect_context->second = second;
3774 connect_context->ct_ctx = ct_ctx; 3774 connect_context->ct_ctx = ct_ctx;
3775 connect_context->task = GNUNET_SCHEDULER_add_now (&schedule_connect, connect_context); 3775 connect_context->task =
3776 GNUNET_CONTAINER_DLL_insert (ct_ctx->pg->cc_head, 3776 GNUNET_SCHEDULER_add_now (&schedule_connect, connect_context);
3777 ct_ctx->pg->cc_tail, 3777 GNUNET_CONTAINER_DLL_insert (ct_ctx->pg->cc_head, ct_ctx->pg->cc_tail,
3778 connect_context); 3778 connect_context);
3779 return GNUNET_YES; 3779 return GNUNET_YES;
3780} 3780}
3781#endif 3781#endif
@@ -7103,16 +7103,14 @@ GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg,
7103 7103
7104 GNUNET_assert (pg->total > 0); 7104 GNUNET_assert (pg->total > 0);
7105 while (NULL != (cc = pg->cc_head)) 7105 while (NULL != (cc = pg->cc_head))
7106 { 7106 {
7107 GNUNET_CONTAINER_DLL_remove (pg->cc_head, 7107 GNUNET_CONTAINER_DLL_remove (pg->cc_head, pg->cc_tail, cc);
7108 pg->cc_tail, 7108 if (GNUNET_SCHEDULER_NO_TASK != cc->task)
7109 cc); 7109 GNUNET_SCHEDULER_cancel (cc->task);
7110 if (GNUNET_SCHEDULER_NO_TASK != cc->task) 7110 if (NULL != cc->cc)
7111 GNUNET_SCHEDULER_cancel (cc->task); 7111 GNUNET_TESTING_daemons_connect_cancel (cc->cc);
7112 if (NULL != cc->cc) 7112 GNUNET_free (cc);
7113 GNUNET_TESTING_daemons_connect_cancel (cc->cc); 7113 }
7114 GNUNET_free (cc);
7115 }
7116 7114
7117 shutdown_ctx = GNUNET_malloc (sizeof (struct ShutdownContext)); 7115 shutdown_ctx = GNUNET_malloc (sizeof (struct ShutdownContext));
7118 shutdown_ctx->delete_files = 7116 shutdown_ctx->delete_files =