diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-25 14:07:12 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-25 14:07:12 +0000 |
commit | 5aeafc44fc03e8c94fd999e202f9fc1302bb919d (patch) | |
tree | bb480e4370706fa384de9bde8fd3a772060085d0 /src/namestore | |
parent | b459c2874da7cfa17662e7a948a91c1a94029a2b (diff) | |
download | gnunet-5aeafc44fc03e8c94fd999e202f9fc1302bb919d.tar.gz gnunet-5aeafc44fc03e8c94fd999e202f9fc1302bb919d.zip |
-indentation
Diffstat (limited to 'src/namestore')
-rw-r--r-- | src/namestore/test_namestore_api_remove.c | 92 |
1 files changed, 50 insertions, 42 deletions
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index 0b027b7e1..4eab0c746 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c | |||
@@ -98,8 +98,11 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
98 | static void | 98 | static void |
99 | name_lookup_proc (void *cls, const struct GNUNET_NAMESTORE_Block *block); | 99 | name_lookup_proc (void *cls, const struct GNUNET_NAMESTORE_Block *block); |
100 | 100 | ||
101 | |||
101 | static void | 102 | static void |
102 | remove_cont (void *cls, int32_t success, const char *emsg) | 103 | remove_cont (void *cls, |
104 | int32_t success, | ||
105 | const char *emsg) | ||
103 | { | 106 | { |
104 | const char *name = cls; | 107 | const char *name = cls; |
105 | if (GNUNET_YES != success) | 108 | if (GNUNET_YES != success) |
@@ -133,55 +136,55 @@ remove_cont (void *cls, int32_t success, const char *emsg) | |||
133 | 136 | ||
134 | static void | 137 | static void |
135 | rd_decrypt_cb (void *cls, | 138 | rd_decrypt_cb (void *cls, |
136 | unsigned int rd_count, | 139 | unsigned int rd_count, |
137 | const struct GNUNET_NAMESTORE_RecordData *rd) | 140 | const struct GNUNET_NAMESTORE_RecordData *rd) |
138 | { | 141 | { |
139 | const char *name = cls; | 142 | const char *name = cls; |
140 | char rd_cmp_data[TEST_RECORD_DATALEN]; | 143 | char rd_cmp_data[TEST_RECORD_DATALEN]; |
141 | if (GNUNET_NO == removed) | 144 | if (GNUNET_NO == removed) |
142 | { | 145 | { |
143 | GNUNET_assert (1 == rd_count); | 146 | GNUNET_assert (1 == rd_count); |
144 | GNUNET_assert (NULL != rd); | 147 | GNUNET_assert (NULL != rd); |
145 | 148 | ||
146 | memset (rd_cmp_data, 'a', TEST_RECORD_DATALEN); | 149 | memset (rd_cmp_data, 'a', TEST_RECORD_DATALEN); |
147 | 150 | ||
148 | GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); | 151 | GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); |
149 | GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size); | 152 | GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size); |
150 | GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN)); | 153 | GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN)); |
151 | 154 | ||
152 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 155 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
153 | "Block was decrypted successfully, removing records \n"); | 156 | "Block was decrypted successfully, removing records \n"); |
154 | 157 | ||
155 | nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, | 158 | nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, |
156 | 0, NULL, &remove_cont, (void *) name); | 159 | 0, NULL, &remove_cont, (void *) name); |
157 | } | 160 | } |
158 | else | 161 | else |
159 | { | 162 | { |
160 | if ((0 != rd_count) /*|| (NULL != rd)*/) | 163 | if ((0 != rd_count) /*|| (NULL != rd)*/) |
161 | { | 164 | { |
162 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 165 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
163 | _("Record was not removed \n")); | 166 | _("Record was not removed \n")); |
164 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) | 167 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) |
165 | GNUNET_SCHEDULER_cancel (endbadly_task); | 168 | GNUNET_SCHEDULER_cancel (endbadly_task); |
166 | endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); | 169 | endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); |
167 | return; | 170 | return; |
168 | } | 171 | } |
169 | 172 | ||
170 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 173 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
171 | _("Record was removed \n")); | 174 | _("Record was removed \n")); |
172 | GNUNET_SCHEDULER_add_now (&end, NULL); | 175 | GNUNET_SCHEDULER_add_now (&end, NULL); |
173 | } | 176 | } |
174 | } | 177 | } |
175 | 178 | ||
179 | |||
176 | static void | 180 | static void |
177 | name_lookup_proc (void *cls, | 181 | name_lookup_proc (void *cls, |
178 | const struct GNUNET_NAMESTORE_Block *block) | 182 | const struct GNUNET_NAMESTORE_Block *block) |
179 | { | 183 | { |
180 | const char *name = cls; | 184 | const char *name = cls; |
181 | nsqe = NULL; | 185 | nsqe = NULL; |
182 | 186 | ||
183 | GNUNET_assert (NULL != cls); | 187 | GNUNET_assert (NULL != cls); |
184 | |||
185 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) | 188 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) |
186 | { | 189 | { |
187 | GNUNET_SCHEDULER_cancel (endbadly_task); | 190 | GNUNET_SCHEDULER_cancel (endbadly_task); |
@@ -194,27 +197,30 @@ name_lookup_proc (void *cls, | |||
194 | _("Namestore returned no block\n")); | 197 | _("Namestore returned no block\n")); |
195 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) | 198 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) |
196 | GNUNET_SCHEDULER_cancel (endbadly_task); | 199 | GNUNET_SCHEDULER_cancel (endbadly_task); |
197 | endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); | 200 | endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); |
198 | return; | 201 | return; |
199 | } | 202 | } |
200 | |||
201 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 203 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
202 | "Namestore returned block, decrypting \n"); | 204 | "Namestore returned block, decrypting \n"); |
203 | GNUNET_assert (GNUNET_OK == GNUNET_NAMESTORE_block_decrypt(block, | 205 | GNUNET_assert (GNUNET_OK == |
204 | &pubkey, name, &rd_decrypt_cb, (void *) name)); | 206 | GNUNET_NAMESTORE_block_decrypt (block, |
207 | &pubkey, name, &rd_decrypt_cb, (void *) name)); | ||
205 | } | 208 | } |
206 | 209 | ||
210 | |||
207 | static void | 211 | static void |
208 | put_cont (void *cls, int32_t success, const char *emsg) | 212 | put_cont (void *cls, int32_t success, |
213 | const char *emsg) | ||
209 | { | 214 | { |
210 | const char *name = cls; | 215 | const char *name = cls; |
211 | 216 | ||
212 | GNUNET_assert (NULL != cls); | 217 | GNUNET_assert (NULL != cls); |
213 | if (GNUNET_SYSERR == success) | 218 | if (GNUNET_SYSERR == success) |
214 | { | 219 | { |
215 | GNUNET_break (0); | 220 | GNUNET_break (0); |
216 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 221 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
217 | _("Namestore could not store record: `%s'\n"), emsg); | 222 | "Namestore could not store record: `%s'\n", |
223 | emsg); | ||
218 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) | 224 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) |
219 | GNUNET_SCHEDULER_cancel (endbadly_task); | 225 | GNUNET_SCHEDULER_cancel (endbadly_task); |
220 | endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); | 226 | endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); |
@@ -227,13 +233,15 @@ put_cont (void *cls, int32_t success, const char *emsg) | |||
227 | (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); | 233 | (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); |
228 | 234 | ||
229 | /* Create derived hash */ | 235 | /* Create derived hash */ |
230 | GNUNET_NAMESTORE_query_from_private_key (privkey, name, &derived_hash); | 236 | GNUNET_NAMESTORE_query_from_private_key (privkey, |
237 | name, | ||
238 | &derived_hash); | ||
231 | 239 | ||
232 | nsqe = GNUNET_NAMESTORE_lookup_block (nsh, &derived_hash, | 240 | nsqe = GNUNET_NAMESTORE_lookup_block (nsh, &derived_hash, |
233 | &name_lookup_proc, (void *) name); | 241 | &name_lookup_proc, (void *) name); |
234 | if (NULL == nsqe) | 242 | if (NULL == nsqe) |
235 | { | 243 | { |
236 | GNUNET_break (0); | 244 | GNUNET_break (0); |
237 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 245 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
238 | _("Namestore cannot perform lookup\n")); | 246 | _("Namestore cannot perform lookup\n")); |
239 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) | 247 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) |