aboutsummaryrefslogtreecommitdiff
path: root/src
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
parent5866faeb79acb4349bfdd2fc0a05c7c7e0ef7ddf (diff)
downloadgnunet-4ca291d0b3ab06a76dc02b046984a261fbc3bfac.tar.gz
gnunet-4ca291d0b3ab06a76dc02b046984a261fbc3bfac.zip
- exit after N rounds
Diffstat (limited to 'src')
-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 afdc4707f..fc18a0d1d 100644
--- a/src/regex/gnunet-daemon-regexprofiler.c
+++ b/src/regex/gnunet-daemon-regexprofiler.c
@@ -89,6 +89,11 @@ static char * regex_prefix;
89 */ 89 */
90static char *rx_with_pfx; 90static char *rx_with_pfx;
91 91
92/**
93 * How many put rounds should we do.
94 */
95static unsigned int rounds = 5;
96
92 97
93/** 98/**
94 * Task run during shutdown. 99 * Task run during shutdown.
@@ -113,7 +118,9 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
113 dht_handle = NULL; 118 dht_handle = NULL;
114 } 119 }
115 120
116 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shut down\n"); 121 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
122 "Daemon for %s shutting down\n",
123 policy_filename);
117} 124}
118 125
119 126
@@ -137,6 +144,13 @@ reannounce_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
137 return; 144 return;
138 } 145 }
139 146
147 if (0 == rounds--)
148 {
149 global_ret = 0;
150 GNUNET_SCHEDULER_shutdown ();
151 GNUNET_free (regex);
152 return;
153 }
140 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Announcing regex: %s\n", regex); 154 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Announcing regex: %s\n", regex);
141 GNUNET_STATISTICS_update (stats_handle, "# regexes announced", 1, GNUNET_NO); 155 GNUNET_STATISTICS_update (stats_handle, "# regexes announced", 1, GNUNET_NO);
142 if (NULL == announce_handle && NULL != regex) 156 if (NULL == announce_handle && NULL != regex)
@@ -184,6 +198,9 @@ announce_regex (const char * regex)
184 return; 198 return;
185 } 199 }
186 200
201 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
202 "Daemon for %s starting\n",
203 policy_filename);
187 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == reannounce_task); 204 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == reannounce_task);
188 copy = GNUNET_strdup (regex); 205 copy = GNUNET_strdup (regex);
189 reannounce_task = GNUNET_SCHEDULER_add_now (reannounce_regex, (void *) copy); 206 reannounce_task = GNUNET_SCHEDULER_add_now (reannounce_regex, (void *) copy);