diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-25 14:19:38 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-25 14:19:38 +0000 |
commit | 992e1d7a51eac4e59e1751037b88f198d4f7014f (patch) | |
tree | d3e48ea84b6272ab8049beab0bcbe2dfbcfe19b1 /src/namestore | |
parent | 161f45f41a34fd89f9bc47f094f72796ca04bce5 (diff) | |
download | gnunet-992e1d7a51eac4e59e1751037b88f198d4f7014f.tar.gz gnunet-992e1d7a51eac4e59e1751037b88f198d4f7014f.zip |
-fix remove testcase
Diffstat (limited to 'src/namestore')
-rw-r--r-- | src/namestore/namestore_api.c | 12 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_remove.c | 60 |
2 files changed, 32 insertions, 40 deletions
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index b323f7cad..bf9f3ffb8 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c | |||
@@ -310,7 +310,7 @@ handle_lookup_block_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
310 | * @param qe the respective entry in the message queue | 310 | * @param qe the respective entry in the message queue |
311 | * @param msg the message we received | 311 | * @param msg the message we received |
312 | * @param size the message size | 312 | * @param size the message size |
313 | * @return GNUNET_OK on success, GNUNET_SYSERR on error and we did NOT notify the client | 313 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error and we did NOT notify the client |
314 | */ | 314 | */ |
315 | static int | 315 | static int |
316 | handle_block_cache_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | 316 | handle_block_cache_response (struct GNUNET_NAMESTORE_QueueEntry *qe, |
@@ -330,12 +330,12 @@ handle_block_cache_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
330 | 330 | ||
331 | 331 | ||
332 | /** | 332 | /** |
333 | * Handle an incoming message of type 'GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE' | 333 | * Handle an incoming message of type #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE |
334 | * | 334 | * |
335 | * @param qe the respective entry in the message queue | 335 | * @param qe the respective entry in the message queue |
336 | * @param msg the message we received | 336 | * @param msg the message we received |
337 | * @param size the message size | 337 | * @param size the message size |
338 | * @return GNUNET_OK on success, GNUNET_SYSERR on error and we did NOT notify the client | 338 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error and we did NOT notify the client |
339 | */ | 339 | */ |
340 | static int | 340 | static int |
341 | handle_record_store_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | 341 | handle_record_store_response (struct GNUNET_NAMESTORE_QueueEntry *qe, |
@@ -360,12 +360,12 @@ handle_record_store_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
360 | 360 | ||
361 | 361 | ||
362 | /** | 362 | /** |
363 | * Handle an incoming message of type 'GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT' | 363 | * Handle an incoming message of type #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT |
364 | * | 364 | * |
365 | * @param qe the respective entry in the message queue | 365 | * @param qe the respective entry in the message queue |
366 | * @param msg the message we received | 366 | * @param msg the message we received |
367 | * @param size the message size | 367 | * @param size the message size |
368 | * @return GNUNET_OK on success, GNUNET_SYSERR on error and we did NOT notify the client | 368 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error and we did NOT notify the client |
369 | */ | 369 | */ |
370 | static int | 370 | static int |
371 | handle_record_result (struct GNUNET_NAMESTORE_QueueEntry *qe, | 371 | handle_record_result (struct GNUNET_NAMESTORE_QueueEntry *qe, |
@@ -763,7 +763,7 @@ do_transmit (struct GNUNET_NAMESTORE_Handle *h); | |||
763 | /** | 763 | /** |
764 | * We can now transmit a message to NAMESTORE. Do it. | 764 | * We can now transmit a message to NAMESTORE. Do it. |
765 | * | 765 | * |
766 | * @param cls the 'struct GNUNET_NAMESTORE_Handle' | 766 | * @param cls the `struct GNUNET_NAMESTORE_Handle` |
767 | * @param size number of bytes we can transmit | 767 | * @param size number of bytes we can transmit |
768 | * @param buf where to copy the messages | 768 | * @param buf where to copy the messages |
769 | * @return number of bytes copied into buf | 769 | * @return number of bytes copied into buf |
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index 4eab0c746..5e8b85544 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c | |||
@@ -141,39 +141,21 @@ rd_decrypt_cb (void *cls, | |||
141 | { | 141 | { |
142 | const char *name = cls; | 142 | const char *name = cls; |
143 | char rd_cmp_data[TEST_RECORD_DATALEN]; | 143 | char rd_cmp_data[TEST_RECORD_DATALEN]; |
144 | if (GNUNET_NO == removed) | 144 | |
145 | { | 145 | GNUNET_assert (GNUNET_NO == removed); |
146 | GNUNET_assert (1 == rd_count); | 146 | GNUNET_assert (1 == rd_count); |
147 | GNUNET_assert (NULL != rd); | 147 | GNUNET_assert (NULL != rd); |
148 | 148 | memset (rd_cmp_data, 'a', TEST_RECORD_DATALEN); | |
149 | memset (rd_cmp_data, 'a', TEST_RECORD_DATALEN); | 149 | |
150 | 150 | GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); | |
151 | GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); | 151 | GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size); |
152 | GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size); | 152 | 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)); | 153 | |
154 | 154 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | |
155 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 155 | "Block was decrypted successfully, removing records \n"); |
156 | "Block was decrypted successfully, removing records \n"); | 156 | |
157 | 157 | nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, | |
158 | nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, | 158 | 0, NULL, &remove_cont, (void *) name); |
159 | 0, NULL, &remove_cont, (void *) name); | ||
160 | } | ||
161 | else | ||
162 | { | ||
163 | if ((0 != rd_count) /*|| (NULL != rd)*/) | ||
164 | { | ||
165 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
166 | _("Record was not removed \n")); | ||
167 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) | ||
168 | GNUNET_SCHEDULER_cancel (endbadly_task); | ||
169 | endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); | ||
170 | return; | ||
171 | } | ||
172 | |||
173 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
174 | _("Record was removed \n")); | ||
175 | GNUNET_SCHEDULER_add_now (&end, NULL); | ||
176 | } | ||
177 | } | 159 | } |
178 | 160 | ||
179 | 161 | ||
@@ -184,6 +166,16 @@ name_lookup_proc (void *cls, | |||
184 | const char *name = cls; | 166 | const char *name = cls; |
185 | nsqe = NULL; | 167 | nsqe = NULL; |
186 | 168 | ||
169 | if (removed && (NULL == block)) | ||
170 | { | ||
171 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) | ||
172 | { | ||
173 | GNUNET_SCHEDULER_cancel (endbadly_task); | ||
174 | endbadly_task = GNUNET_SCHEDULER_NO_TASK; | ||
175 | } | ||
176 | GNUNET_SCHEDULER_add_now (&end, NULL); | ||
177 | return; | ||
178 | } | ||
187 | GNUNET_assert (NULL != cls); | 179 | GNUNET_assert (NULL != cls); |
188 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) | 180 | if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) |
189 | { | 181 | { |
@@ -200,7 +192,7 @@ name_lookup_proc (void *cls, | |||
200 | endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); | 192 | endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); |
201 | return; | 193 | return; |
202 | } | 194 | } |
203 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 195 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
204 | "Namestore returned block, decrypting \n"); | 196 | "Namestore returned block, decrypting \n"); |
205 | GNUNET_assert (GNUNET_OK == | 197 | GNUNET_assert (GNUNET_OK == |
206 | GNUNET_NAMESTORE_block_decrypt (block, | 198 | GNUNET_NAMESTORE_block_decrypt (block, |