gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r22490 - gnunet/src/namestore
Date: Thu, 5 Jul 2012 09:58:57 +0200

Author: grothoff
Date: 2012-07-05 09:58:57 +0200 (Thu, 05 Jul 2012)
New Revision: 22490

Modified:
   gnunet/src/namestore/gnunet-namestore.c
   gnunet/src/namestore/namestore_common.c
Log:
-LRN:  Correct time == 0 handling:
  With logging in namespace comparison it is now clear to me that
deletion fails due to expiration times not being equal. And sure
enough, gnunet-namespace sets expiration to 0 when submitting a
template for seek-and-destroy. This patch:
  1) Changes gnunet-namespace to fail if the time is not absolute or
unspecified. If it's absolute, it's used as-is (hoping that the user
got the exact expiration time somewhere - probably from -D). If it's
unspecified, it is set to zero (as it was before).
  2) Comparison ignores expiration time if either of the arguments has
expiration time set to zero (i'm assuming that real records will never
have expiration time of zero. If it's absolute, zero is in the past.
If it's relative, zero makes no sense). Also, i'm not sure it makes
sense to have two records that have different expiration times, but
are otherwise identical (i.e. both are public or private, same data,
size etc). Lookups will find (and will be satisfied) by either, so
there's no sense in keeping both (unless you're doing some wizardry
with expirations, but i'm not sure it's worth the compexity).


Modified: gnunet/src/namestore/gnunet-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-namestore.c     2012-07-05 07:58:05 UTC (rev 
22489)
+++ gnunet/src/namestore/gnunet-namestore.c     2012-07-05 07:58:57 UTC (rev 
22490)
@@ -457,6 +457,15 @@
       ret = 1;
       return;     
     }
+    if (etime_is_rel && del)
+    {
+      fprintf (stderr,
+              _("Deletion requires either absolute time, or no time at all. 
Got relative time `%s' instead.\n"),
+              expirationstring);
+      GNUNET_SCHEDULER_shutdown ();
+      ret = 1;
+      return;
+    }
   } 
   else if (add)
   {
@@ -524,6 +533,8 @@
     rd.data_size = data_size;
     rd.record_type = type;
     rd.expiration_time = 0;
+    if (!etime_is_rel)
+      rd.expiration_time = etime_abs.abs_value;
     rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
     del_qe = GNUNET_NAMESTORE_record_remove (ns,
                                             zone_pkey,

Modified: gnunet/src/namestore/namestore_common.c
===================================================================
--- gnunet/src/namestore/namestore_common.c     2012-07-05 07:58:05 UTC (rev 
22489)
+++ gnunet/src/namestore/namestore_common.c     2012-07-05 07:58:57 UTC (rev 
22490)
@@ -178,7 +178,8 @@
         "Record type %lu != %lu\n", a->record_type, b->record_type);
     return GNUNET_NO;
   }
-  if (a->expiration_time != b->expiration_time)
+  if ((a->expiration_time != b->expiration_time) &&
+      ((a->expiration_time != 0) && (b->expiration_time != 0)))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
         "Expiration time %llu != %llu\n", a->expiration_time, 
b->expiration_time);




reply via email to

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