gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r29550 - gnunet/src/namestore


From: gnunet
Subject: [GNUnet-SVN] r29550 - gnunet/src/namestore
Date: Wed, 25 Sep 2013 16:19:38 +0200

Author: grothoff
Date: 2013-09-25 16:19:38 +0200 (Wed, 25 Sep 2013)
New Revision: 29550

Modified:
   gnunet/src/namestore/namestore_api.c
   gnunet/src/namestore/test_namestore_api_remove.c
Log:
-fix remove testcase

Modified: gnunet/src/namestore/namestore_api.c
===================================================================
--- gnunet/src/namestore/namestore_api.c        2013-09-25 14:11:58 UTC (rev 
29549)
+++ gnunet/src/namestore/namestore_api.c        2013-09-25 14:19:38 UTC (rev 
29550)
@@ -310,7 +310,7 @@
  * @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 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 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 @@
 /**
  * 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

Modified: gnunet/src/namestore/test_namestore_api_remove.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_remove.c    2013-09-25 14:11:58 UTC 
(rev 29549)
+++ gnunet/src/namestore/test_namestore_api_remove.c    2013-09-25 14:19:38 UTC 
(rev 29550)
@@ -141,39 +141,21 @@
 {
   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 @@
   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 @@
     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,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]