diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-06-13 06:24:36 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-06-13 06:24:36 +0000 |
commit | 22fc1a86eb65cd9ed578c9e7bfc952814fbc499f (patch) | |
tree | 56f230b91562bbc1c67bc0e57814858eed50dc9c /src | |
parent | 184240c9c28f784bbdea72742e0a3ce3e3ee4652 (diff) | |
download | gnunet-22fc1a86eb65cd9ed578c9e7bfc952814fbc499f.tar.gz gnunet-22fc1a86eb65cd9ed578c9e7bfc952814fbc499f.zip |
cancel task
Diffstat (limited to 'src')
-rw-r--r-- | src/hostlist/gnunet-daemon-hostlist.c | 10 | ||||
-rw-r--r-- | src/hostlist/hostlist-server.c | 32 |
2 files changed, 29 insertions, 13 deletions
diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index e2e64a717..ceb3415d5 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c | |||
@@ -22,6 +22,11 @@ | |||
22 | * @file hostlist/gnunet-daemon-hostlist.c | 22 | * @file hostlist/gnunet-daemon-hostlist.c |
23 | * @brief code for bootstrapping via hostlist servers | 23 | * @brief code for bootstrapping via hostlist servers |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * | ||
26 | * TODO: | ||
27 | * - implement -a and -e switches (send P2P messages about our hostlist URL, | ||
28 | * receive such messages and automatically update our hostlist URL config | ||
29 | * value). | ||
25 | */ | 30 | */ |
26 | 31 | ||
27 | #include <stdlib.h> | 32 | #include <stdlib.h> |
@@ -96,7 +101,7 @@ core_init (void *cls, | |||
96 | { | 101 | { |
97 | if (advertising && (NULL != server)) | 102 | if (advertising && (NULL != server)) |
98 | { | 103 | { |
99 | /* TODO: provide "server" to 'hostlist' module */ | 104 | /* FIXME: provide "server" to 'hostlist' module */ |
100 | } | 105 | } |
101 | } | 106 | } |
102 | 107 | ||
@@ -150,8 +155,7 @@ run (void *cls, | |||
150 | stats = GNUNET_STATISTICS_create (sched, "hostlist", cfg); | 155 | stats = GNUNET_STATISTICS_create (sched, "hostlist", cfg); |
151 | if (learning) | 156 | if (learning) |
152 | { | 157 | { |
153 | // FIXME! | 158 | /* FIXME (register handler with core for hostlist ads) */ |
154 | // (register handler with core for hostlist ads) | ||
155 | } | 159 | } |
156 | if (bootstrapping) | 160 | if (bootstrapping) |
157 | { | 161 | { |
diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c index a481aa7a7..be0fa84df 100644 --- a/src/hostlist/hostlist-server.c +++ b/src/hostlist/hostlist-server.c | |||
@@ -51,6 +51,11 @@ static struct GNUNET_CONFIGURATION_Handle *cfg; | |||
51 | static struct GNUNET_SCHEDULER_Handle *sched; | 51 | static struct GNUNET_SCHEDULER_Handle *sched; |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Our primary task. | ||
55 | */ | ||
56 | static GNUNET_SCHEDULER_TaskIdentifier hostlist_task; | ||
57 | |||
58 | /** | ||
54 | * Our canonical response. | 59 | * Our canonical response. |
55 | */ | 60 | */ |
56 | static struct MHD_Response *response; | 61 | static struct MHD_Response *response; |
@@ -190,6 +195,10 @@ static void | |||
190 | prepare_daemon (void); | 195 | prepare_daemon (void); |
191 | 196 | ||
192 | 197 | ||
198 | /** | ||
199 | * Call MHD to process pending requests and then go back | ||
200 | * and schedule the next run. | ||
201 | */ | ||
193 | static void | 202 | static void |
194 | run_daemon (void *cls, | 203 | run_daemon (void *cls, |
195 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 204 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
@@ -229,16 +238,17 @@ prepare_daemon () | |||
229 | tv.value = (uint64_t) timeout; | 238 | tv.value = (uint64_t) timeout; |
230 | else | 239 | else |
231 | tv = GNUNET_TIME_UNIT_FOREVER_REL; | 240 | tv = GNUNET_TIME_UNIT_FOREVER_REL; |
232 | GNUNET_SCHEDULER_add_select (sched, | 241 | hostlist_task |
233 | GNUNET_NO, | 242 | = GNUNET_SCHEDULER_add_select (sched, |
234 | GNUNET_SCHEDULER_PRIORITY_HIGH, | 243 | GNUNET_NO, |
235 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK, | 244 | GNUNET_SCHEDULER_PRIORITY_HIGH, |
236 | tv, | 245 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK, |
237 | max, | 246 | tv, |
238 | &rs, | 247 | max, |
239 | &ws, | 248 | &rs, |
240 | &run_daemon, | 249 | &ws, |
241 | NULL); | 250 | &run_daemon, |
251 | NULL); | ||
242 | } | 252 | } |
243 | 253 | ||
244 | 254 | ||
@@ -290,6 +300,8 @@ GNUNET_HOSTLIST_server_start (struct GNUNET_CONFIGURATION_Handle *c, | |||
290 | void | 300 | void |
291 | GNUNET_HOSTLIST_server_stop () | 301 | GNUNET_HOSTLIST_server_stop () |
292 | { | 302 | { |
303 | GNUNET_SCHEDULER_cancel (sched, hostlist_task); | ||
304 | hostlist_task = GNUNET_SCHEDULER_NO_PREREQUISITE_TASK; | ||
293 | MHD_stop_daemon (daemon_handle); | 305 | MHD_stop_daemon (daemon_handle); |
294 | daemon_handle = NULL; | 306 | daemon_handle = NULL; |
295 | } | 307 | } |