aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/gnunet-namestore.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/namestore/gnunet-namestore.c')
-rw-r--r--src/namestore/gnunet-namestore.c61
1 files changed, 11 insertions, 50 deletions
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 9ed8f400c..a636644f8 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -318,28 +318,18 @@ test_finished ()
318} 318}
319 319
320 320
321/**
322 * Continuation called to notify client about result of the
323 * operation.
324 *
325 * @param cls closure, location of the QueueEntry pointer to NULL out
326 * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate)
327 * #GNUNET_NO if content was already there
328 * #GNUNET_YES (or other positive value) on success
329 * @param emsg NULL on success, otherwise an error message
330 */
331static void 321static void
332add_continuation (void *cls, int32_t success, const char *emsg) 322add_continuation (void *cls, enum GNUNET_ErrorCode ec)
333{ 323{
334 struct GNUNET_NAMESTORE_QueueEntry **qe = cls; 324 struct GNUNET_NAMESTORE_QueueEntry **qe = cls;
335 325
336 *qe = NULL; 326 *qe = NULL;
337 if (GNUNET_YES != success) 327 if (GNUNET_EC_NONE != ec)
338 { 328 {
339 fprintf (stderr, 329 fprintf (stderr,
340 _ ("Adding record failed: %s\n"), 330 _ ("Adding record failed: %s\n"),
341 (GNUNET_NO == success) ? "record exists" : emsg); 331 GNUNET_ErrorCode_get_hint (ec));
342 if (GNUNET_NO != success) 332 if (GNUNET_EC_NAMESTORE_RECORD_EXISTS != ec)
343 ret = 1; 333 ret = 1;
344 } 334 }
345 ret = 0; 335 ret = 0;
@@ -347,34 +337,15 @@ add_continuation (void *cls, int32_t success, const char *emsg)
347} 337}
348 338
349 339
350/**
351 * Continuation called to notify client about result of the
352 * operation.
353 *
354 * @param cls closure, unused
355 * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate)
356 * #GNUNET_NO if content was already there
357 * #GNUNET_YES (or other positive value) on success
358 * @param emsg NULL on success, otherwise an error message
359 */
360static void 340static void
361del_continuation (void *cls, int32_t success, const char *emsg) 341del_continuation (void *cls, enum GNUNET_ErrorCode ec)
362{ 342{
363 (void) cls; 343 (void) cls;
364 del_qe = NULL; 344 del_qe = NULL;
365 if (GNUNET_NO == success) 345 if (GNUNET_EC_NAMESTORE_RECORD_NOT_FOUND == ec)
366 { 346 {
367 fprintf (stderr, 347 fprintf (stderr,
368 _ ("Deleting record failed, record does not exist%s%s\n"), 348 _ ("Deleting record failed: %s\n"), GNUNET_ErrorCode_get_hint (ec));
369 (NULL != emsg) ? ": " : "",
370 (NULL != emsg) ? emsg : "");
371 }
372 if (GNUNET_SYSERR == success)
373 {
374 fprintf (stderr,
375 _ ("Deleting record failed%s%s\n"),
376 (NULL != emsg) ? ": " : "",
377 (NULL != emsg) ? emsg : "");
378 } 349 }
379 test_finished (); 350 test_finished ();
380} 351}
@@ -898,27 +869,17 @@ parse_expiration (const char *expirationstring,
898} 869}
899 870
900 871
901/**
902 * Function called when namestore is done with the replace
903 * operation.
904 *
905 * @param cls NULL
906 * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate)
907 * #GNUNET_NO if content was already there or not found
908 * #GNUNET_YES (or other positive value) on success
909 * @param emsg NULL on success, otherwise an error message
910 */
911static void 872static void
912replace_cont (void *cls, int success, const char *emsg) 873replace_cont (void *cls, enum GNUNET_ErrorCode ec)
913{ 874{
914 (void) cls; 875 (void) cls;
915 876
916 set_qe = NULL; 877 set_qe = NULL;
917 if (GNUNET_OK != success) 878 if (GNUNET_EC_NONE != ec)
918 { 879 {
919 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 880 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
920 _ ("Failed to replace records: %s\n"), 881 _ ("%s\n"),
921 emsg); 882 GNUNET_ErrorCode_get_hint (ec));
922 ret = 1; /* fail from 'main' */ 883 ret = 1; /* fail from 'main' */
923 } 884 }
924 GNUNET_SCHEDULER_shutdown (); 885 GNUNET_SCHEDULER_shutdown ();