diff options
Diffstat (limited to 'src/regex/gnunet-daemon-regexprofiler.c')
-rw-r--r-- | src/regex/gnunet-daemon-regexprofiler.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c index 1ff3b55e3..42fc8ace0 100644 --- a/src/regex/gnunet-daemon-regexprofiler.c +++ b/src/regex/gnunet-daemon-regexprofiler.c | |||
@@ -117,7 +117,11 @@ shutdown_task (void *cls) | |||
117 | REGEX_INTERNAL_announce_cancel (announce_handle); | 117 | REGEX_INTERNAL_announce_cancel (announce_handle); |
118 | announce_handle = NULL; | 118 | announce_handle = NULL; |
119 | } | 119 | } |
120 | 120 | if (NULL != reannounce_task) | |
121 | { | ||
122 | GNUNET_free (GNUNET_SCHEDULER_cancel (reannounce_task)); | ||
123 | reannounce_task = NULL; | ||
124 | } | ||
121 | if (NULL != dht_handle) | 125 | if (NULL != dht_handle) |
122 | { | 126 | { |
123 | GNUNET_DHT_disconnect (dht_handle); | 127 | GNUNET_DHT_disconnect (dht_handle); |
@@ -142,16 +146,8 @@ reannounce_regex (void *cls) | |||
142 | { | 146 | { |
143 | char *regex = cls; | 147 | char *regex = cls; |
144 | struct GNUNET_TIME_Relative random_delay; | 148 | struct GNUNET_TIME_Relative random_delay; |
145 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
146 | 149 | ||
147 | reannounce_task = NULL; | 150 | reannounce_task = NULL; |
148 | tc = GNUNET_SCHEDULER_get_task_context (); | ||
149 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | ||
150 | { | ||
151 | GNUNET_free (regex); | ||
152 | return; | ||
153 | } | ||
154 | |||
155 | if (0 == rounds--) | 151 | if (0 == rounds--) |
156 | { | 152 | { |
157 | global_ret = 0; | 153 | global_ret = 0; |
@@ -195,7 +191,7 @@ reannounce_regex (void *cls) | |||
195 | * @param regex regular expression to announce on this peer's cadet. | 191 | * @param regex regular expression to announce on this peer's cadet. |
196 | */ | 192 | */ |
197 | static void | 193 | static void |
198 | announce_regex (const char * regex) | 194 | announce_regex (const char *regex) |
199 | { | 195 | { |
200 | char *copy; | 196 | char *copy; |
201 | 197 | ||
@@ -210,7 +206,8 @@ announce_regex (const char * regex) | |||
210 | policy_filename); | 206 | policy_filename); |
211 | GNUNET_assert (NULL == reannounce_task); | 207 | GNUNET_assert (NULL == reannounce_task); |
212 | copy = GNUNET_strdup (regex); | 208 | copy = GNUNET_strdup (regex); |
213 | reannounce_task = GNUNET_SCHEDULER_add_now (reannounce_regex, (void *) copy); | 209 | reannounce_task = GNUNET_SCHEDULER_add_now (&reannounce_regex, |
210 | (void *) copy); | ||
214 | } | 211 | } |
215 | 212 | ||
216 | 213 | ||
@@ -347,14 +344,17 @@ run (void *cls, char *const *args GNUNET_UNUSED, | |||
347 | REGEX_TEST_free_from_file (components); | 344 | REGEX_TEST_free_from_file (components); |
348 | 345 | ||
349 | /* Announcing regexes from policy_filename */ | 346 | /* Announcing regexes from policy_filename */ |
350 | GNUNET_asprintf (&rx_with_pfx, "%s(%s)(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f)*", regex_prefix, regex); | 347 | GNUNET_asprintf (&rx_with_pfx, |
348 | "%s(%s)(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f)*", | ||
349 | regex_prefix, | ||
350 | regex); | ||
351 | announce_regex (rx_with_pfx); | 351 | announce_regex (rx_with_pfx); |
352 | GNUNET_free (regex); | 352 | GNUNET_free (regex); |
353 | GNUNET_free (rx_with_pfx); | 353 | GNUNET_free (rx_with_pfx); |
354 | 354 | ||
355 | /* Scheduled the task to clean up when shutdown is called */ | 355 | /* Scheduled the task to clean up when shutdown is called */ |
356 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, | 356 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, |
357 | NULL); | 357 | NULL); |
358 | } | 358 | } |
359 | 359 | ||
360 | 360 | ||