aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-12-19 14:02:25 +0000
committerChristian Grothoff <christian@grothoff.org>2011-12-19 14:02:25 +0000
commit61e81163b05a44b3d0e72b4ef8c781f98b6c2c6c (patch)
tree4edd7545b8a98f371166b1d383be0257f016627f /src/datastore
parentbf2d1ccefd7b5bd13295733a36bf19afba46f4b2 (diff)
downloadgnunet-61e81163b05a44b3d0e72b4ef8c781f98b6c2c6c.tar.gz
gnunet-61e81163b05a44b3d0e72b4ef8c781f98b6c2c6c.zip
-actually initialize min_expiration field
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/gnunet-service-datastore.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c
index 5474bc101..0e82a38fd 100644
--- a/src/datastore/gnunet-service-datastore.c
+++ b/src/datastore/gnunet-service-datastore.c
@@ -198,6 +198,13 @@ static GNUNET_SCHEDULER_TaskIdentifier expired_kill_task;
198 */ 198 */
199const struct GNUNET_CONFIGURATION_Handle *cfg; 199const struct GNUNET_CONFIGURATION_Handle *cfg;
200 200
201/**
202 * Minimum time that content should have to not be discarded instantly
203 * (time stamp of any content that we've been discarding recently to
204 * stay below the quota). FOREVER if we had to expire content with
205 * non-zero priority.
206 */
207static struct GNUNET_TIME_Absolute min_expiration;
201 208
202/** 209/**
203 * Handle for reporting statistics. 210 * Handle for reporting statistics.
@@ -336,6 +343,7 @@ expired_processor (void *cls, const GNUNET_HashCode * key, uint32_t size,
336 GNUNET_h2s (key), type, 343 GNUNET_h2s (key), type,
337 (unsigned long long) (now.abs_value - expiration.abs_value)); 344 (unsigned long long) (now.abs_value - expiration.abs_value));
338#endif 345#endif
346 min_expiration = now;
339 GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes expired"), size, 347 GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes expired"), size,
340 GNUNET_YES); 348 GNUNET_YES);
341 GNUNET_CONTAINER_bloomfilter_remove (filter, key); 349 GNUNET_CONTAINER_bloomfilter_remove (filter, key);
@@ -401,6 +409,10 @@ quota_processor (void *cls, const GNUNET_HashCode * key, uint32_t size,
401 *need = 0; 409 *need = 0;
402 else 410 else
403 *need -= size + GNUNET_DATASTORE_ENTRY_OVERHEAD; 411 *need -= size + GNUNET_DATASTORE_ENTRY_OVERHEAD;
412 if (priority > 0)
413 min_expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
414 else
415 min_expiration = expiration;
404 GNUNET_STATISTICS_update (stats, 416 GNUNET_STATISTICS_update (stats,
405 gettext_noop ("# bytes purged (low-priority)"), 417 gettext_noop ("# bytes purged (low-priority)"),
406 size, GNUNET_YES); 418 size, GNUNET_YES);
@@ -543,6 +555,7 @@ transmit_status (struct GNUNET_SERVER_Client *client, int code, const char *msg)
543 sm->header.size = htons (sizeof (struct StatusMessage) + slen); 555 sm->header.size = htons (sizeof (struct StatusMessage) + slen);
544 sm->header.type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_STATUS); 556 sm->header.type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_STATUS);
545 sm->status = htonl (code); 557 sm->status = htonl (code);
558 sm->min_expiration = GNUNET_TIME_absolute_hton (min_expiration);
546 if (slen > 0) 559 if (slen > 0)
547 memcpy (&sm[1], msg, slen); 560 memcpy (&sm[1], msg, slen);
548 transmit (client, &sm->header); 561 transmit (client, &sm->header);