aboutsummaryrefslogtreecommitdiff
path: root/src/hostlist/gnunet-daemon-hostlist.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-11-04 15:43:09 +0000
committerChristian Grothoff <christian@grothoff.org>2009-11-04 15:43:09 +0000
commit9b20dceb26e1bae0feea2df03412da153bba619c (patch)
tree8a0cd24d717ad155c1277e6fbcc357b2ae0586eb /src/hostlist/gnunet-daemon-hostlist.c
parent0e1db619d8621ed62d9798398bce8f3121c3f5ae (diff)
downloadgnunet-9b20dceb26e1bae0feea2df03412da153bba619c.tar.gz
gnunet-9b20dceb26e1bae0feea2df03412da153bba619c.zip
fixing core API for early shutdown handling
Diffstat (limited to 'src/hostlist/gnunet-daemon-hostlist.c')
-rw-r--r--src/hostlist/gnunet-daemon-hostlist.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c
index 78584cac9..2c4aca6d0 100644
--- a/src/hostlist/gnunet-daemon-hostlist.c
+++ b/src/hostlist/gnunet-daemon-hostlist.c
@@ -71,6 +71,11 @@ static int provide_hostlist;
71static struct GNUNET_STATISTICS_Handle *stats; 71static struct GNUNET_STATISTICS_Handle *stats;
72 72
73/** 73/**
74 * Handle to the core service (NULL until we've connected to it).
75 */
76struct GNUNET_CORE_Handle *core;
77
78/**
74 * gnunet-daemon-hostlist command line options. 79 * gnunet-daemon-hostlist command line options.
75 */ 80 */
76static struct GNUNET_GETOPT_CommandLineOption options[] = { 81static struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -119,6 +124,7 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
119 GNUNET_NO); 124 GNUNET_NO);
120 stats = NULL; 125 stats = NULL;
121 } 126 }
127 GNUNET_CORE_disconnect (core);
122} 128}
123 129
124 130
@@ -167,18 +173,26 @@ run (void *cls,
167 { 173 {
168 GNUNET_HOSTLIST_server_start (cfg, sched, stats); 174 GNUNET_HOSTLIST_server_start (cfg, sched, stats);
169 } 175 }
170 GNUNET_CORE_connect (sched, cfg, 176 core = GNUNET_CORE_connect (sched, cfg,
171 GNUNET_TIME_UNIT_FOREVER_REL, 177 GNUNET_TIME_UNIT_FOREVER_REL,
172 NULL, 178 NULL,
173 &core_init, 179 &core_init,
174 ch, dh, 180 ch, dh,
175 NULL, 181 NULL,
176 NULL, GNUNET_NO, 182 NULL, GNUNET_NO,
177 NULL, GNUNET_NO, 183 NULL, GNUNET_NO,
178 handlers); 184 handlers);
179 GNUNET_SCHEDULER_add_delayed (sched, 185 GNUNET_SCHEDULER_add_delayed (sched,
180 GNUNET_TIME_UNIT_FOREVER_REL, 186 GNUNET_TIME_UNIT_FOREVER_REL,
181 &cleaning_task, NULL); 187 &cleaning_task, NULL);
188 if (NULL == core)
189 {
190 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
191 _("Failed to connect to `%s' service.\n"),
192 "core");
193 GNUNET_SCHEDULER_shutdown (sched);
194 return;
195 }
182} 196}
183 197
184 198