diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-06-25 09:21:56 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-06-25 09:21:56 +0000 |
commit | 52456fbad2ee611f08a43d517f3bd65970bd5b5b (patch) | |
tree | a1503307640a811fd7ed04b8e668919cf845e435 /src/peerinfo/gnunet-service-peerinfo.c | |
parent | 916af2ca3879d470fad37ef4e6232dfd574b11fe (diff) | |
download | gnunet-52456fbad2ee611f08a43d517f3bd65970bd5b5b.tar.gz gnunet-52456fbad2ee611f08a43d517f3bd65970bd5b5b.zip |
-fail hard if we could not create the directory for the HELLOs
Diffstat (limited to 'src/peerinfo/gnunet-service-peerinfo.c')
-rw-r--r-- | src/peerinfo/gnunet-service-peerinfo.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index 2fe00c707..17ec7303d 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c | |||
@@ -1183,18 +1183,18 @@ free_host_entry (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
1183 | static void | 1183 | static void |
1184 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1184 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
1185 | { | 1185 | { |
1186 | struct NotificationContext *cur; | 1186 | struct NotificationContext *cur; |
1187 | struct NotificationContext *next; | 1187 | struct NotificationContext *next; |
1188 | GNUNET_SERVER_notification_context_destroy (notify_list); | ||
1189 | notify_list = NULL; | ||
1190 | 1188 | ||
1191 | for (cur = nc_head; NULL != cur; cur = next) | 1189 | GNUNET_SERVER_notification_context_destroy (notify_list); |
1192 | { | 1190 | notify_list = NULL; |
1193 | next = cur->next; | ||
1194 | GNUNET_CONTAINER_DLL_remove (nc_head, nc_tail, cur); | ||
1195 | GNUNET_free (cur); | ||
1196 | } | ||
1197 | 1191 | ||
1192 | for (cur = nc_head; NULL != cur; cur = next) | ||
1193 | { | ||
1194 | next = cur->next; | ||
1195 | GNUNET_CONTAINER_DLL_remove (nc_head, nc_tail, cur); | ||
1196 | GNUNET_free (cur); | ||
1197 | } | ||
1198 | GNUNET_CONTAINER_multihashmap_iterate (hostmap, &free_host_entry, NULL); | 1198 | GNUNET_CONTAINER_multihashmap_iterate (hostmap, &free_host_entry, NULL); |
1199 | GNUNET_CONTAINER_multihashmap_destroy (hostmap); | 1199 | GNUNET_CONTAINER_multihashmap_destroy (hostmap); |
1200 | if (NULL != stats) | 1200 | if (NULL != stats) |
@@ -1235,14 +1235,21 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1235 | stats = GNUNET_STATISTICS_create ("peerinfo", cfg); | 1235 | stats = GNUNET_STATISTICS_create ("peerinfo", cfg); |
1236 | notify_list = GNUNET_SERVER_notification_context_create (server, 0); | 1236 | notify_list = GNUNET_SERVER_notification_context_create (server, 0); |
1237 | noio = GNUNET_CONFIGURATION_get_value_yesno (cfg, "peerinfo", "NO_IO"); | 1237 | noio = GNUNET_CONFIGURATION_get_value_yesno (cfg, "peerinfo", "NO_IO"); |
1238 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, | ||
1239 | NULL); | ||
1238 | if (GNUNET_YES != noio) | 1240 | if (GNUNET_YES != noio) |
1239 | { | 1241 | { |
1240 | GNUNET_assert (GNUNET_OK == | 1242 | GNUNET_assert (GNUNET_OK == |
1241 | GNUNET_CONFIGURATION_get_value_filename (cfg, "peerinfo", | 1243 | GNUNET_CONFIGURATION_get_value_filename (cfg, "peerinfo", |
1242 | "HOSTS", | 1244 | "HOSTS", |
1243 | &networkIdDirectory)); | 1245 | &networkIdDirectory)); |
1244 | GNUNET_DISK_directory_create (networkIdDirectory); | 1246 | if (GNUNET_OK != |
1245 | 1247 | GNUNET_DISK_directory_create (networkIdDirectory)) | |
1248 | { | ||
1249 | GNUNET_SCHEDULER_shutdown (); | ||
1250 | return; | ||
1251 | } | ||
1252 | |||
1246 | GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, | 1253 | GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, |
1247 | &cron_scan_directory_data_hosts, NULL); | 1254 | &cron_scan_directory_data_hosts, NULL); |
1248 | 1255 | ||
@@ -1268,9 +1275,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1268 | } | 1275 | } |
1269 | GNUNET_SERVER_add_handlers (server, handlers); | 1276 | GNUNET_SERVER_add_handlers (server, handlers); |
1270 | GNUNET_SERVER_disconnect_notify (server, &disconnect_cb, NULL) ; | 1277 | GNUNET_SERVER_disconnect_notify (server, &disconnect_cb, NULL) ; |
1271 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, | ||
1272 | NULL); | ||
1273 | |||
1274 | } | 1278 | } |
1275 | 1279 | ||
1276 | 1280 | ||