diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-10-23 15:00:54 +0900 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-10-23 15:00:54 +0900 |
commit | bb81464ede13b1cba93cd031de466bbc8c18f04f (patch) | |
tree | 6fc675d02f89c9611afb371b5291bb0fd86eb59e /src/reclaim | |
parent | b391cb1d41ad900385338936b655fc0699a61eca (diff) | |
download | gnunet-bb81464ede13b1cba93cd031de466bbc8c18f04f.tar.gz gnunet-bb81464ede13b1cba93cd031de466bbc8c18f04f.zip |
NAMESTORE: Introduce GANA-managed error codes
Diffstat (limited to 'src/reclaim')
-rw-r--r-- | src/reclaim/did_core.c | 7 | ||||
-rw-r--r-- | src/reclaim/gnunet-did.c | 9 | ||||
-rw-r--r-- | src/reclaim/gnunet-service-reclaim.c | 26 | ||||
-rw-r--r-- | src/reclaim/gnunet-service-reclaim_tickets.c | 27 |
4 files changed, 34 insertions, 35 deletions
diff --git a/src/reclaim/did_core.c b/src/reclaim/did_core.c index 8c5e6c812..f3caff707 100644 --- a/src/reclaim/did_core.c +++ b/src/reclaim/did_core.c | |||
@@ -121,21 +121,20 @@ DID_resolve (const char *did, | |||
121 | 121 | ||
122 | static void | 122 | static void |
123 | DID_create_did_store_cb (void *cls, | 123 | DID_create_did_store_cb (void *cls, |
124 | int32_t success, | 124 | enum GNUNET_ErrorCode ec) |
125 | const char *emsg) | ||
126 | { | 125 | { |
127 | DID_action_callback *cb = ((struct DID_action_return *) cls)->cb; | 126 | DID_action_callback *cb = ((struct DID_action_return *) cls)->cb; |
128 | void *cls_did_create_cb = ((struct DID_action_return *) cls)->cls; | 127 | void *cls_did_create_cb = ((struct DID_action_return *) cls)->cls; |
129 | free (cls); | 128 | free (cls); |
130 | 129 | ||
131 | if (GNUNET_OK == success) | 130 | if (GNUNET_EC_NONE == ec) |
132 | { | 131 | { |
133 | cb (GNUNET_OK, (void *) cls_did_create_cb); | 132 | cb (GNUNET_OK, (void *) cls_did_create_cb); |
134 | } | 133 | } |
135 | else | 134 | else |
136 | { | 135 | { |
137 | // TODO: Log emsg. Not writing it to STDOUT | 136 | // TODO: Log emsg. Not writing it to STDOUT |
138 | printf ("%s\n", emsg); | 137 | printf ("%s\n", GNUNET_ErrorCode_get_hint (ec)); |
139 | cb (GNUNET_NO, (void *) cls_did_create_cb); | 138 | cb (GNUNET_NO, (void *) cls_did_create_cb); |
140 | } | 139 | } |
141 | } | 140 | } |
diff --git a/src/reclaim/gnunet-did.c b/src/reclaim/gnunet-did.c index 25f571520..b5f5f4922 100644 --- a/src/reclaim/gnunet-did.c +++ b/src/reclaim/gnunet-did.c | |||
@@ -223,11 +223,11 @@ struct Event | |||
223 | * @param emgs | 223 | * @param emgs |
224 | */ | 224 | */ |
225 | static void | 225 | static void |
226 | remove_did_document_namestore_cb (void *cls, int32_t success, const char *emgs) | 226 | remove_did_document_namestore_cb (void *cls, enum GNUNET_ErrorCode ec) |
227 | { | 227 | { |
228 | struct Event *event; | 228 | struct Event *event; |
229 | 229 | ||
230 | if (success != GNUNET_SYSERR) | 230 | if (GNUNET_EC_NONE == ec) |
231 | { | 231 | { |
232 | event = (struct Event *) cls; | 232 | event = (struct Event *) cls; |
233 | 233 | ||
@@ -246,10 +246,7 @@ remove_did_document_namestore_cb (void *cls, int32_t success, const char *emgs) | |||
246 | else { | 246 | else { |
247 | printf ("Something went wrong when deleting the DID Document\n"); | 247 | printf ("Something went wrong when deleting the DID Document\n"); |
248 | 248 | ||
249 | if (emgs != NULL) | 249 | printf ("%s\n", GNUNET_ErrorCode_get_hint (ec)); |
250 | { | ||
251 | printf ("%s\n", emgs); | ||
252 | } | ||
253 | 250 | ||
254 | GNUNET_SCHEDULER_add_now (cleanup, NULL); | 251 | GNUNET_SCHEDULER_add_now (cleanup, NULL); |
255 | ret = 0; | 252 | ret = 0; |
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c index 5290621d6..5c484e55d 100644 --- a/src/reclaim/gnunet-service-reclaim.c +++ b/src/reclaim/gnunet-service-reclaim.c | |||
@@ -970,7 +970,7 @@ handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm) | |||
970 | * @param emsg error message (NULL if success=GNUNET_OK) | 970 | * @param emsg error message (NULL if success=GNUNET_OK) |
971 | */ | 971 | */ |
972 | static void | 972 | static void |
973 | attr_store_cont (void *cls, int32_t success, const char *emsg) | 973 | attr_store_cont (void *cls, enum GNUNET_ErrorCode ec) |
974 | { | 974 | { |
975 | struct AttributeStoreHandle *ash = cls; | 975 | struct AttributeStoreHandle *ash = cls; |
976 | struct GNUNET_MQ_Envelope *env; | 976 | struct GNUNET_MQ_Envelope *env; |
@@ -981,11 +981,11 @@ attr_store_cont (void *cls, int32_t success, const char *emsg) | |||
981 | ash->client->store_op_tail, | 981 | ash->client->store_op_tail, |
982 | ash); | 982 | ash); |
983 | 983 | ||
984 | if (GNUNET_SYSERR == success) | 984 | if (GNUNET_EC_NONE != ec) |
985 | { | 985 | { |
986 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 986 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
987 | "Failed to store attribute %s\n", | 987 | "Failed to store attribute %s\n", |
988 | emsg); | 988 | GNUNET_ErrorCode_get_hint (ec)); |
989 | cleanup_as_handle (ash); | 989 | cleanup_as_handle (ash); |
990 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 990 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
991 | return; | 991 | return; |
@@ -1108,7 +1108,7 @@ handle_attribute_store_message (void *cls, | |||
1108 | * @param emsg error message (NULL if success=GNUNET_OK) | 1108 | * @param emsg error message (NULL if success=GNUNET_OK) |
1109 | */ | 1109 | */ |
1110 | static void | 1110 | static void |
1111 | cred_store_cont (void *cls, int32_t success, const char *emsg) | 1111 | cred_store_cont (void *cls, enum GNUNET_ErrorCode ec) |
1112 | { | 1112 | { |
1113 | struct AttributeStoreHandle *ash = cls; | 1113 | struct AttributeStoreHandle *ash = cls; |
1114 | struct GNUNET_MQ_Envelope *env; | 1114 | struct GNUNET_MQ_Envelope *env; |
@@ -1119,11 +1119,11 @@ cred_store_cont (void *cls, int32_t success, const char *emsg) | |||
1119 | ash->client->store_op_tail, | 1119 | ash->client->store_op_tail, |
1120 | ash); | 1120 | ash); |
1121 | 1121 | ||
1122 | if (GNUNET_SYSERR == success) | 1122 | if (GNUNET_EC_NONE != ec) |
1123 | { | 1123 | { |
1124 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1124 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1125 | "Failed to store credential: %s\n", | 1125 | "Failed to store credential: %s\n", |
1126 | emsg); | 1126 | GNUNET_ErrorCode_get_hint (ec)); |
1127 | cleanup_as_handle (ash); | 1127 | cleanup_as_handle (ash); |
1128 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 1128 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
1129 | return; | 1129 | return; |
@@ -1395,7 +1395,7 @@ update_tickets (void *cls); | |||
1395 | * @param emsg error message (NULL if success=GNUNET_OK) | 1395 | * @param emsg error message (NULL if success=GNUNET_OK) |
1396 | */ | 1396 | */ |
1397 | static void | 1397 | static void |
1398 | ticket_updated (void *cls, int32_t success, const char *emsg) | 1398 | ticket_updated (void *cls, enum GNUNET_ErrorCode ec) |
1399 | { | 1399 | { |
1400 | struct AttributeDeleteHandle *adh = cls; | 1400 | struct AttributeDeleteHandle *adh = cls; |
1401 | 1401 | ||
@@ -1519,12 +1519,12 @@ static void | |||
1519 | purge_attributes (void *cls);; | 1519 | purge_attributes (void *cls);; |
1520 | 1520 | ||
1521 | static void | 1521 | static void |
1522 | offending_attr_delete_cont (void *cls, int32_t success, const char *emsg) | 1522 | offending_attr_delete_cont (void *cls, enum GNUNET_ErrorCode ec) |
1523 | { | 1523 | { |
1524 | struct AttributeDeleteHandle *adh = cls; | 1524 | struct AttributeDeleteHandle *adh = cls; |
1525 | 1525 | ||
1526 | adh->ns_qe = NULL; | 1526 | adh->ns_qe = NULL; |
1527 | if (GNUNET_SYSERR == success) | 1527 | if (GNUNET_EC_NONE != ec) |
1528 | { | 1528 | { |
1529 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1529 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1530 | "Error deleting attribute %s\n", | 1530 | "Error deleting attribute %s\n", |
@@ -1664,12 +1664,12 @@ start_consistency_update (void *cls) | |||
1664 | * @param emsg error message (NULL if success=GNUNET_OK) | 1664 | * @param emsg error message (NULL if success=GNUNET_OK) |
1665 | */ | 1665 | */ |
1666 | static void | 1666 | static void |
1667 | attr_delete_cont (void *cls, int32_t success, const char *emsg) | 1667 | attr_delete_cont (void *cls, enum GNUNET_ErrorCode ec) |
1668 | { | 1668 | { |
1669 | struct AttributeDeleteHandle *adh = cls; | 1669 | struct AttributeDeleteHandle *adh = cls; |
1670 | 1670 | ||
1671 | adh->ns_qe = NULL; | 1671 | adh->ns_qe = NULL; |
1672 | if (GNUNET_SYSERR == success) | 1672 | if (GNUNET_EC_NONE != ec) |
1673 | { | 1673 | { |
1674 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1674 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1675 | "Error deleting attribute %s\n", | 1675 | "Error deleting attribute %s\n", |
@@ -1755,12 +1755,12 @@ handle_attribute_delete_message (void *cls, | |||
1755 | * @param emsg error message (NULL if success=GNUNET_OK) | 1755 | * @param emsg error message (NULL if success=GNUNET_OK) |
1756 | */ | 1756 | */ |
1757 | static void | 1757 | static void |
1758 | cred_delete_cont (void *cls, int32_t success, const char *emsg) | 1758 | cred_delete_cont (void *cls, enum GNUNET_ErrorCode ec) |
1759 | { | 1759 | { |
1760 | struct AttributeDeleteHandle *adh = cls; | 1760 | struct AttributeDeleteHandle *adh = cls; |
1761 | 1761 | ||
1762 | adh->ns_qe = NULL; | 1762 | adh->ns_qe = NULL; |
1763 | if (GNUNET_SYSERR == success) | 1763 | if (GNUNET_EC_NONE != ec) |
1764 | { | 1764 | { |
1765 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1765 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1766 | "Error deleting credential `%s'\n", | 1766 | "Error deleting credential `%s'\n", |
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.c b/src/reclaim/gnunet-service-reclaim_tickets.c index a17dfb0e2..9552094f1 100644 --- a/src/reclaim/gnunet-service-reclaim_tickets.c +++ b/src/reclaim/gnunet-service-reclaim_tickets.c | |||
@@ -394,7 +394,7 @@ process_tickets (void *cls); | |||
394 | * @param emsg (NULL on success) | 394 | * @param emsg (NULL on success) |
395 | */ | 395 | */ |
396 | static void | 396 | static void |
397 | ticket_processed (void *cls, int32_t success, const char *emsg) | 397 | ticket_processed (void *cls, enum GNUNET_ErrorCode ec) |
398 | { | 398 | { |
399 | struct RECLAIM_TICKETS_RevokeHandle *rvk = cls; | 399 | struct RECLAIM_TICKETS_RevokeHandle *rvk = cls; |
400 | 400 | ||
@@ -596,16 +596,16 @@ move_attrs_cont (void *cls) | |||
596 | * @param emsg error message (NULL on success) | 596 | * @param emsg error message (NULL on success) |
597 | */ | 597 | */ |
598 | static void | 598 | static void |
599 | del_attr_finished (void *cls, int32_t success, const char *emsg) | 599 | del_attr_finished (void *cls, enum GNUNET_ErrorCode ec) |
600 | { | 600 | { |
601 | struct RECLAIM_TICKETS_RevokeHandle *rvk = cls; | 601 | struct RECLAIM_TICKETS_RevokeHandle *rvk = cls; |
602 | 602 | ||
603 | rvk->ns_qe = NULL; | 603 | rvk->ns_qe = NULL; |
604 | if (GNUNET_SYSERR == success) | 604 | if (GNUNET_EC_NONE != ec) |
605 | { | 605 | { |
606 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 606 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
607 | "Error removing attribute: %s\n", | 607 | "Error removing attribute: %s\n", |
608 | emsg); | 608 | GNUNET_ErrorCode_get_hint (ec)); |
609 | rvk->cb (rvk->cb_cls, GNUNET_SYSERR); | 609 | rvk->cb (rvk->cb_cls, GNUNET_SYSERR); |
610 | cleanup_rvk (rvk); | 610 | cleanup_rvk (rvk); |
611 | return; | 611 | return; |
@@ -625,15 +625,17 @@ del_attr_finished (void *cls, int32_t success, const char *emsg) | |||
625 | * @param emsg error message (NULL on success) | 625 | * @param emsg error message (NULL on success) |
626 | */ | 626 | */ |
627 | static void | 627 | static void |
628 | move_attr_finished (void *cls, int32_t success, const char *emsg) | 628 | move_attr_finished (void *cls, enum GNUNET_ErrorCode ec) |
629 | { | 629 | { |
630 | struct RECLAIM_TICKETS_RevokeHandle *rvk = cls; | 630 | struct RECLAIM_TICKETS_RevokeHandle *rvk = cls; |
631 | char *label; | 631 | char *label; |
632 | 632 | ||
633 | rvk->ns_qe = NULL; | 633 | rvk->ns_qe = NULL; |
634 | if (GNUNET_SYSERR == success) | 634 | if (GNUNET_EC_NONE != ec) |
635 | { | 635 | { |
636 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error moving attribute: %s\n", emsg); | 636 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
637 | "Error moving attribute: %s\n", | ||
638 | GNUNET_ErrorCode_get_hint (ec)); | ||
637 | rvk->cb (rvk->cb_cls, GNUNET_SYSERR); | 639 | rvk->cb (rvk->cb_cls, GNUNET_SYSERR); |
638 | cleanup_rvk (rvk); | 640 | cleanup_rvk (rvk); |
639 | return; | 641 | return; |
@@ -802,14 +804,15 @@ move_attrs (struct RECLAIM_TICKETS_RevokeHandle *rvk) | |||
802 | * @param emsg error message (NULL on success) | 804 | * @param emsg error message (NULL on success) |
803 | */ | 805 | */ |
804 | static void | 806 | static void |
805 | remove_ticket_cont (void *cls, int32_t success, const char *emsg) | 807 | remove_ticket_cont (void *cls, enum GNUNET_ErrorCode ec) |
806 | { | 808 | { |
807 | struct RECLAIM_TICKETS_RevokeHandle *rvk = cls; | 809 | struct RECLAIM_TICKETS_RevokeHandle *rvk = cls; |
808 | 810 | ||
809 | rvk->ns_qe = NULL; | 811 | rvk->ns_qe = NULL; |
810 | if (GNUNET_SYSERR == success) | 812 | if (GNUNET_EC_NONE != ec) |
811 | { | 813 | { |
812 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", emsg); | 814 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", |
815 | GNUNET_ErrorCode_get_hint (ec)); | ||
813 | rvk->cb (rvk->cb_cls, GNUNET_SYSERR); | 816 | rvk->cb (rvk->cb_cls, GNUNET_SYSERR); |
814 | cleanup_rvk (rvk); | 817 | cleanup_rvk (rvk); |
815 | return; | 818 | return; |
@@ -1250,12 +1253,12 @@ cleanup_issue_handle (struct TicketIssueHandle *handle) | |||
1250 | * @param emsg error message (or NULL on success) | 1253 | * @param emsg error message (or NULL on success) |
1251 | */ | 1254 | */ |
1252 | static void | 1255 | static void |
1253 | store_ticket_issue_cont (void *cls, int32_t success, const char *emsg) | 1256 | store_ticket_issue_cont (void *cls, enum GNUNET_ErrorCode ec) |
1254 | { | 1257 | { |
1255 | struct TicketIssueHandle *handle = cls; | 1258 | struct TicketIssueHandle *handle = cls; |
1256 | 1259 | ||
1257 | handle->ns_qe = NULL; | 1260 | handle->ns_qe = NULL; |
1258 | if (GNUNET_SYSERR == success) | 1261 | if (GNUNET_EC_NONE != ec) |
1259 | { | 1262 | { |
1260 | handle->cb (handle->cb_cls, | 1263 | handle->cb (handle->cb_cls, |
1261 | &handle->ticket, | 1264 | &handle->ticket, |