[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 04/05: rps: improve churn testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 04/05: rps: improve churn testing |
Date: |
Fri, 29 Dec 2017 00:56:21 +0100 |
This is an automated email from the git hooks/post-receive script.
julius-buenger pushed a commit to branch master
in repository gnunet.
commit 6380681b87431baa0155c8544f053de2aa78cb5d
Author: Julius Bünger <address@hidden>
AuthorDate: Fri Dec 29 00:51:12 2017 +0100
rps: improve churn testing
---
src/rps/.gitignore | 2 +-
src/rps/test_rps.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/src/rps/.gitignore b/src/rps/.gitignore
index 77c9a498c..e45356eda 100644
--- a/src/rps/.gitignore
+++ b/src/rps/.gitignore
@@ -12,4 +12,4 @@ test_service_rps_custommap
test_service_rps_peers
test_service_rps_sampler_elem
test_service_rps_view
-
+test_rps_churn
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index b8f7588e1..0114a19fe 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -1028,6 +1028,33 @@ req_cancel_cb (struct RPSPeer *rps_peer)
}
/***********************************
+ * CHURN
+***********************************/
+
+static void
+churn (void *cls);
+
+static void
+churn_test_cb (struct RPSPeer *rps_peer)
+{
+ /* Start churn */
+ if (GNUNET_YES == cur_test_run.have_churn && NULL == churn_task)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Starting churn task\n");
+ churn_task = GNUNET_SCHEDULER_add_delayed (
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5),
+ churn,
+ NULL);
+ } else {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Not starting churn task\n");
+ }
+
+ schedule_missing_requests (rps_peer);
+}
+
+/***********************************
* PROFILER
***********************************/
@@ -1153,6 +1180,9 @@ churn (void *cls)
double portion_go_online;
double portion_go_offline;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Churn function executing\n");
+
/* Compute the probability for an online peer to go offline
* this round */
portion_online = num_peers_online * 1.0 / num_peers;
@@ -1263,10 +1293,15 @@ profiler_cb (struct RPSPeer *rps_peer)
/* Start churn */
if (GNUNET_YES == cur_test_run.have_churn && NULL == churn_task)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Starting churn task\n");
churn_task = GNUNET_SCHEDULER_add_delayed (
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5),
churn,
NULL);
+ } else {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Not starting churn task\n");
}
/* Only request peer ids at one peer.
@@ -1358,6 +1393,24 @@ run (void *cls,
struct OpListEntry *entry;
uint32_t num_mal_peers;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "RUN was called\n");
+
+ /* Check whether we timed out */
+ if (n_peers != num_peers ||
+ NULL == peers ||
+ 0 == links_succeeded)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Going down due to args (eg.
timeout)\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\tn_peers: %u\n", n_peers);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\tnum_peers: %" PRIu32 "\n",
num_peers);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\tpeers: %p\n", peers);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\tlinks_succeeded: %u\n",
links_succeeded);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+
+
+ /* Initialize peers */
testbed_peers = peers;
num_peers_online = 0;
for (i = 0; i < num_peers; i++)
@@ -1515,7 +1568,10 @@ main (int argc, char *argv[])
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test churn\n");
cur_test_run.name = "test-rps-churn";
num_peers = 5;
- cur_test_run.main_test = single_req_cb;
+ cur_test_run.init_peer = default_init_peer;
+ cur_test_run.main_test = churn_test_cb;
+ cur_test_run.reply_handle = default_reply_handle;
+ cur_test_run.eval_cb = default_eval_cb;
cur_test_run.have_churn = GNUNET_YES;
timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10);
}
--
To stop receiving notification emails like this one, please contact
address@hidden