aboutsummaryrefslogtreecommitdiff
path: root/src/regex/gnunet-daemon-regexprofiler.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-04-11 13:49:30 +0000
committerBart Polot <bart@net.in.tum.de>2013-04-11 13:49:30 +0000
commit4ca291d0b3ab06a76dc02b046984a261fbc3bfac (patch)
treedb2bd5068bbb32a376f1021b68f5af287157400a /src/regex/gnunet-daemon-regexprofiler.c
parent5866faeb79acb4349bfdd2fc0a05c7c7e0ef7ddf (diff)
- exit after N rounds
Diffstat (limited to 'src/regex/gnunet-daemon-regexprofiler.c')
-rw-r--r--src/regex/gnunet-daemon-regexprofiler.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c
index afdc4707fc..fc18a0d1d0 100644
--- a/src/regex/gnunet-daemon-regexprofiler.c
+++ b/src/regex/gnunet-daemon-regexprofiler.c
@@ -89,6 +89,11 @@ static char * regex_prefix;
*/
static char *rx_with_pfx;
+/**
+ * How many put rounds should we do.
+ */
+static unsigned int rounds = 5;
+
/**
* Task run during shutdown.
@@ -113,7 +118,9 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
dht_handle = NULL;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shut down\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Daemon for %s shutting down\n",
+ policy_filename);
}
@@ -137,6 +144,13 @@ reannounce_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
return;
}
+ if (0 == rounds--)
+ {
+ global_ret = 0;
+ GNUNET_SCHEDULER_shutdown ();
+ GNUNET_free (regex);
+ return;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Announcing regex: %s\n", regex);
GNUNET_STATISTICS_update (stats_handle, "# regexes announced", 1, GNUNET_NO);
if (NULL == announce_handle && NULL != regex)
@@ -184,6 +198,9 @@ announce_regex (const char * regex)
return;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Daemon for %s starting\n",
+ policy_filename);
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == reannounce_task);
copy = GNUNET_strdup (regex);
reannounce_task = GNUNET_SCHEDULER_add_now (reannounce_regex, (void *) copy);