gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r20141 - gnunet/src/namestore
Date: Wed, 29 Feb 2012 10:59:50 +0100

Author: wachs
Date: 2012-02-29 10:59:50 +0100 (Wed, 29 Feb 2012)
New Revision: 20141

Modified:
   gnunet/src/namestore/namestore_common.c
   gnunet/src/namestore/test_namestore_api_lookup.c
Log:
- changes


Modified: gnunet/src/namestore/namestore_common.c
===================================================================
--- gnunet/src/namestore/namestore_common.c     2012-02-29 09:55:59 UTC (rev 
20140)
+++ gnunet/src/namestore/namestore_common.c     2012-02-29 09:59:50 UTC (rev 
20141)
@@ -128,6 +128,12 @@
   uint32_t data_size;
   int c;
 
+  if (len == 0)
+  {
+    (*dest) = NULL;
+    return 0;
+  }
+
   offset = 0;
   elements = 0;
   while (offset < len)
@@ -141,6 +147,13 @@
     elements ++;
   }
 
+  if (elements == 0)
+  {
+    (*dest) = NULL;
+    return 0;
+  }
+
+
   GNUNET_assert (len == offset);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deserializing %i records with total 
length of %u\n", elements, len);
 

Modified: gnunet/src/namestore/test_namestore_api_lookup.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_lookup.c    2012-02-29 09:55:59 UTC 
(rev 20140)
+++ gnunet/src/namestore/test_namestore_api_lookup.c    2012-02-29 09:59:50 UTC 
(rev 20141)
@@ -122,17 +122,26 @@
 void name_lookup_proc (void *cls,
                             const struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
                             struct GNUNET_TIME_Absolute expire,
-                            const char *name,
+                            const char *n,
                             unsigned int rd_count,
                             const struct GNUNET_NAMESTORE_RecordData *rd,
                             const struct GNUNET_CRYPTO_RsaSignature *signature)
 {
-  if (name != NULL)
+  static int found = GNUNET_NO;
+
+  if (n != NULL)
+  {
+    found = GNUNET_YES;
     res = 0;
+  }
   else
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to lookup records for name 
`%s'\n", zone_key, name, rd_count, rd, signature);
-    res = 1;
+    if (found != GNUNET_YES)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to lookup records for name 
`%s'\n", name);
+      res = 1;
+    }
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Lookup done for name %s'\n", name);
   }
 
   GNUNET_SCHEDULER_add_now(&end, NULL);
@@ -152,6 +161,7 @@
   else
   {
     res = 1;
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to put records for name 
`%s'\n", name);
     GNUNET_SCHEDULER_add_now(&end, NULL);
   }
 }




reply via email to

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