diff options
Diffstat (limited to 'src/regex/gnunet-daemon-regexprofiler.c')
-rw-r--r-- | src/regex/gnunet-daemon-regexprofiler.c | 19 |
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 | */ |
90 | static char *rx_with_pfx; | 90 | static char *rx_with_pfx; |
91 | 91 | ||
92 | /** | ||
93 | * How many put rounds should we do. | ||
94 | */ | ||
95 | static 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); |