From: Christian Grothoff Date: Wed, 25 Sep 2013 14:19:38 +0000 (+0000) Subject: -fix remove testcase X-Git-Tag: initial-import-from-subversion-38251~7106 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=992e1d7a51eac4e59e1751037b88f198d4f7014f;p=oweals%2Fgnunet.git -fix remove testcase --- 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, * @param qe the respective entry in the message queue * @param msg the message we received * @param size the message size - * @return GNUNET_OK on success, GNUNET_SYSERR on error and we did NOT notify the client + * @return #GNUNET_OK on success, #GNUNET_SYSERR on error and we did NOT notify the client */ static int handle_block_cache_response (struct GNUNET_NAMESTORE_QueueEntry *qe, @@ -330,12 +330,12 @@ handle_block_cache_response (struct GNUNET_NAMESTORE_QueueEntry *qe, /** - * Handle an incoming message of type 'GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE' + * Handle an incoming message of type #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE * * @param qe the respective entry in the message queue * @param msg the message we received * @param size the message size - * @return GNUNET_OK on success, GNUNET_SYSERR on error and we did NOT notify the client + * @return #GNUNET_OK on success, #GNUNET_SYSERR on error and we did NOT notify the client */ static int handle_record_store_response (struct GNUNET_NAMESTORE_QueueEntry *qe, @@ -360,12 +360,12 @@ handle_record_store_response (struct GNUNET_NAMESTORE_QueueEntry *qe, /** - * Handle an incoming message of type 'GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT' + * Handle an incoming message of type #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT * * @param qe the respective entry in the message queue * @param msg the message we received * @param size the message size - * @return GNUNET_OK on success, GNUNET_SYSERR on error and we did NOT notify the client + * @return #GNUNET_OK on success, #GNUNET_SYSERR on error and we did NOT notify the client */ static int handle_record_result (struct GNUNET_NAMESTORE_QueueEntry *qe, @@ -763,7 +763,7 @@ do_transmit (struct GNUNET_NAMESTORE_Handle *h); /** * We can now transmit a message to NAMESTORE. Do it. * - * @param cls the 'struct GNUNET_NAMESTORE_Handle' + * @param cls the `struct GNUNET_NAMESTORE_Handle` * @param size number of bytes we can transmit * @param buf where to copy the messages * @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, { const char *name = cls; char rd_cmp_data[TEST_RECORD_DATALEN]; - if (GNUNET_NO == removed) - { - GNUNET_assert (1 == rd_count); - GNUNET_assert (NULL != rd); - - memset (rd_cmp_data, 'a', TEST_RECORD_DATALEN); - - GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); - GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size); - GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN)); - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Block was decrypted successfully, removing records \n"); - - nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, - 0, NULL, &remove_cont, (void *) name); - } - else - { - if ((0 != rd_count) /*|| (NULL != rd)*/) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _("Record was not removed \n")); - if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) - GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); - return; - } - - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _("Record was removed \n")); - GNUNET_SCHEDULER_add_now (&end, NULL); - } + + GNUNET_assert (GNUNET_NO == removed); + GNUNET_assert (1 == rd_count); + GNUNET_assert (NULL != rd); + memset (rd_cmp_data, 'a', TEST_RECORD_DATALEN); + + GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); + GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size); + GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN)); + + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Block was decrypted successfully, removing records \n"); + + nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, + 0, NULL, &remove_cont, (void *) name); } @@ -184,6 +166,16 @@ name_lookup_proc (void *cls, const char *name = cls; nsqe = NULL; + if (removed && (NULL == block)) + { + if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) + { + GNUNET_SCHEDULER_cancel (endbadly_task); + endbadly_task = GNUNET_SCHEDULER_NO_TASK; + } + GNUNET_SCHEDULER_add_now (&end, NULL); + return; + } GNUNET_assert (NULL != cls); if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) { @@ -200,7 +192,7 @@ name_lookup_proc (void *cls, endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); return; } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Namestore returned block, decrypting \n"); GNUNET_assert (GNUNET_OK == GNUNET_NAMESTORE_block_decrypt (block,