aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-30 08:17:37 +0000
committerChristian Grothoff <christian@grothoff.org>2016-04-30 08:17:37 +0000
commit95f9076a2139f5fb042b944a0658b6cda2fa35db (patch)
treeb0826a2a1dcf812e6b4450fe6b05d47cd53ae49d /src/namestore
parent7746f68db77b9ca3c4aaca24ab2ce5253461240b (diff)
downloadgnunet-95f9076a2139f5fb042b944a0658b6cda2fa35db.tar.gz
gnunet-95f9076a2139f5fb042b944a0658b6cda2fa35db.zip
implementing new scheduler shutdown semantics
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/gnunet-namestore-fcfsd.c3
-rw-r--r--src/namestore/gnunet-namestore.c3
-rw-r--r--src/namestore/gnunet-service-namestore.c4
-rw-r--r--src/namestore/plugin_rest_namestore.c26
4 files changed, 25 insertions, 11 deletions
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c
index 82d73f6de..c2f506f6d 100644
--- a/src/namestore/gnunet-namestore-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -988,8 +988,7 @@ run (void *cls, char *const *args, const char *cfgfile,
988 } 988 }
989 id_op = GNUNET_IDENTITY_get (identity, "fcfsd", 989 id_op = GNUNET_IDENTITY_get (identity, "fcfsd",
990 &identity_cb, NULL); 990 &identity_cb, NULL);
991 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 991 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
992 &do_shutdown, NULL);
993} 992}
994 993
995 994
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 0965d8cbe..90214e9d6 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -1006,8 +1006,7 @@ testservice_id_task (void *cls, int result)
1006 ret = -1; 1006 ret = -1;
1007 return; 1007 return;
1008 } 1008 }
1009 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 1009 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, (void *) cfg);
1010 &do_shutdown, (void *) cfg);
1011 1010
1012 if (NULL == ego_name) 1011 if (NULL == ego_name)
1013 { 1012 {
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 0bfd002f5..4be55cf9b 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -1689,8 +1689,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1689 GNUNET_SERVER_disconnect_notify (server, 1689 GNUNET_SERVER_disconnect_notify (server,
1690 &client_disconnect_notification, 1690 &client_disconnect_notification,
1691 NULL); 1691 NULL);
1692 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup_task, 1692 GNUNET_SCHEDULER_add_shutdown (&cleanup_task,
1693 NULL); 1693 NULL);
1694} 1694}
1695 1695
1696 1696
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c
index cfebd63a7..4612528c6 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -242,6 +242,7 @@ struct RequestHandle
242 242
243/** 243/**
244 * Cleanup lookup handle 244 * Cleanup lookup handle
245 *
245 * @param handle Handle to clean up 246 * @param handle Handle to clean up
246 */ 247 */
247static void 248static void
@@ -250,6 +251,7 @@ cleanup_handle (struct RequestHandle *handle)
250 struct RecordEntry *record_entry; 251 struct RecordEntry *record_entry;
251 struct RecordEntry *record_tmp; 252 struct RecordEntry *record_tmp;
252 int i; 253 int i;
254
253 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 255 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
254 "Cleaning up\n"); 256 "Cleaning up\n");
255 if (NULL != handle->resp_object) 257 if (NULL != handle->resp_object)
@@ -295,6 +297,7 @@ cleanup_handle (struct RequestHandle *handle)
295 GNUNET_free (handle); 297 GNUNET_free (handle);
296} 298}
297 299
300
298/** 301/**
299 * Create json representation of a GNSRECORD 302 * Create json representation of a GNSRECORD
300 * 303 *
@@ -350,9 +353,9 @@ gnsrecord_to_json (const struct GNUNET_GNSRECORD_Data *rd)
350 353
351 354
352/** 355/**
353 * Task run on shutdown. Cleans up everything. 356 * Task run on error. Generates error response and cleans up.
354 * 357 *
355 * @param cls unused 358 * @param cls the request to generate an error response for
356 */ 359 */
357static void 360static void
358do_error (void *cls) 361do_error (void *cls)
@@ -365,6 +368,21 @@ do_error (void *cls)
365} 368}
366 369
367 370
371/**
372 * Task run on timeout.
373 *
374 * @param cls the request to time out
375 */
376static void
377do_timeout (void *cls)
378{
379 struct RequestHandle *handle = cls;
380
381 handle->timeout_task = NULL;
382 do_error (handle);
383}
384
385
368static void 386static void
369cleanup_handle_delayed (void *cls) 387cleanup_handle_delayed (void *cls)
370{ 388{
@@ -1138,10 +1156,8 @@ rest_identity_process_request(struct RestConnectionDataHandle *conndata_handle,
1138 &testservice_id_task, 1156 &testservice_id_task,
1139 handle); 1157 handle);
1140 handle->timeout_task = GNUNET_SCHEDULER_add_delayed (handle->timeout, 1158 handle->timeout_task = GNUNET_SCHEDULER_add_delayed (handle->timeout,
1141 &do_error, 1159 &do_timeout,
1142 handle); 1160 handle);
1143
1144
1145} 1161}
1146 1162
1147/** 1163/**