-fix remove testcase
authorChristian Grothoff <christian@grothoff.org>
Wed, 25 Sep 2013 14:19:38 +0000 (14:19 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 25 Sep 2013 14:19:38 +0000 (14:19 +0000)
src/namestore/namestore_api.c
src/namestore/test_namestore_api_remove.c

index b323f7cad5fc96d0baddec7b757f93e4745d6bb1..bf9f3ffb856d04efe648f65d3b5aca756a393b0d 100644 (file)
@@ -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
index 4eab0c7467294a031623fef5b3d1abcaf99555e2..5e8b855441229bb4ffeaa0a91a1acb17098218f7 100644 (file)
@@ -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,