gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r18687 - in gnunet/src: datastore include


From: gnunet
Subject: [GNUnet-SVN] r18687 - in gnunet/src: datastore include
Date: Mon, 19 Dec 2011 15:02:25 +0100

Author: grothoff
Date: 2011-12-19 15:02:25 +0100 (Mon, 19 Dec 2011)
New Revision: 18687

Modified:
   gnunet/src/datastore/gnunet-service-datastore.c
   gnunet/src/include/gnunet_datastore_service.h
Log:
-actually initialize min_expiration field

Modified: gnunet/src/datastore/gnunet-service-datastore.c
===================================================================
--- gnunet/src/datastore/gnunet-service-datastore.c     2011-12-19 13:54:35 UTC 
(rev 18686)
+++ gnunet/src/datastore/gnunet-service-datastore.c     2011-12-19 14:02:25 UTC 
(rev 18687)
@@ -198,6 +198,13 @@
  */
 const struct GNUNET_CONFIGURATION_Handle *cfg;
 
+/**
+ * Minimum time that content should have to not be discarded instantly
+ * (time stamp of any content that we've been discarding recently to
+ * stay below the quota).  FOREVER if we had to expire content with
+ * non-zero priority.
+ */
+static struct GNUNET_TIME_Absolute min_expiration;
 
 /**
  * Handle for reporting statistics.
@@ -336,6 +343,7 @@
               GNUNET_h2s (key), type,
               (unsigned long long) (now.abs_value - expiration.abs_value));
 #endif
+  min_expiration = now;
   GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes expired"), size,
                             GNUNET_YES);
   GNUNET_CONTAINER_bloomfilter_remove (filter, key);
@@ -401,6 +409,10 @@
     *need = 0;
   else
     *need -= size + GNUNET_DATASTORE_ENTRY_OVERHEAD;
+  if (priority > 0)
+    min_expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
+  else
+    min_expiration = expiration;
   GNUNET_STATISTICS_update (stats,
                             gettext_noop ("# bytes purged (low-priority)"),
                             size, GNUNET_YES);
@@ -543,6 +555,7 @@
   sm->header.size = htons (sizeof (struct StatusMessage) + slen);
   sm->header.type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_STATUS);
   sm->status = htonl (code);
+  sm->min_expiration = GNUNET_TIME_absolute_hton (min_expiration);
   if (slen > 0)
     memcpy (&sm[1], msg, slen);
   transmit (client, &sm->header);

Modified: gnunet/src/include/gnunet_datastore_service.h
===================================================================
--- gnunet/src/include/gnunet_datastore_service.h       2011-12-19 13:54:35 UTC 
(rev 18686)
+++ gnunet/src/include/gnunet_datastore_service.h       2011-12-19 14:02:25 UTC 
(rev 18687)
@@ -86,8 +86,9 @@
  * @param success GNUNET_SYSERR on failure (including timeout/queue drop)
  *                GNUNET_NO if content was already there
  *                GNUNET_YES (or other positive value) on success
- * @param min_expiration minimum expiration time required for content to be 
stored
- *                by the datacache at this time, zero for unknown
+ * @param min_expiration minimum expiration time required for 0-priority 
content to be stored
+ *                by the datacache at this time, zero for unknown, forever if 
we have no
+ *                space for 0-priority content
  * @param msg NULL on success, otherwise an error message
  */
 typedef void (*GNUNET_DATASTORE_ContinuationWithStatus) (void *cls,




reply via email to

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