diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-02-21 20:11:20 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-02-21 20:14:51 +0100 |
commit | 6ffe3aeeacef611c3c34d18fd6b74763ca013b7c (patch) | |
tree | c813dbf855b0e7f22f80d62d92b105e2bfbafc15 /src/namestore/test_namestore_api_remove.c | |
parent | a1ea03e3ac15bf02d6772d3207059957cbfce0e8 (diff) | |
download | gnunet-6ffe3aeeacef611c3c34d18fd6b74763ca013b7c.tar.gz gnunet-6ffe3aeeacef611c3c34d18fd6b74763ca013b7c.zip |
handle errors without crashing
Diffstat (limited to 'src/namestore/test_namestore_api_remove.c')
-rw-r--r-- | src/namestore/test_namestore_api_remove.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index c6c439e86..2d670c1ee 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c | |||
@@ -98,19 +98,22 @@ remove_cont (void *cls, | |||
98 | int32_t success, | 98 | int32_t success, |
99 | const char *emsg) | 99 | const char *emsg) |
100 | { | 100 | { |
101 | nsqe = NULL; | ||
101 | if (GNUNET_YES != success) | 102 | if (GNUNET_YES != success) |
102 | { | 103 | { |
103 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 104 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
104 | _("Records could not be removed: `%s'\n"), emsg); | 105 | _("Records could not be removed: `%s'\n"), |
105 | if (endbadly_task != NULL) | 106 | emsg); |
107 | if (NULL != endbadly_task) | ||
106 | GNUNET_SCHEDULER_cancel (endbadly_task); | 108 | GNUNET_SCHEDULER_cancel (endbadly_task); |
107 | endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); | 109 | endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, |
110 | NULL); | ||
108 | return; | 111 | return; |
109 | } | 112 | } |
110 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 113 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
111 | "Records were removed, perform lookup\n"); | 114 | "Records were removed, perform lookup\n"); |
112 | removed = GNUNET_YES; | 115 | removed = GNUNET_YES; |
113 | if (endbadly_task != NULL) | 116 | if (NULL != endbadly_task) |
114 | GNUNET_SCHEDULER_cancel (endbadly_task); | 117 | GNUNET_SCHEDULER_cancel (endbadly_task); |
115 | GNUNET_SCHEDULER_add_now (&end, NULL); | 118 | GNUNET_SCHEDULER_add_now (&end, NULL); |
116 | } | 119 | } |
@@ -139,8 +142,11 @@ put_cont (void *cls, int32_t success, | |||
139 | "Name store added record for `%s': %s\n", | 142 | "Name store added record for `%s': %s\n", |
140 | name, | 143 | name, |
141 | (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); | 144 | (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); |
142 | nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, | 145 | nsqe = GNUNET_NAMESTORE_records_store (nsh, |
143 | 0, NULL, &remove_cont, (void *) name); | 146 | privkey, |
147 | name, | ||
148 | 0, NULL, | ||
149 | &remove_cont, (void *) name); | ||
144 | } | 150 | } |
145 | 151 | ||
146 | 152 | ||