aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-12-06 14:13:38 +0000
committerChristian Grothoff <christian@grothoff.org>2011-12-06 14:13:38 +0000
commit8852f5f8ff3d521897175ddeb711d6b77e03fa8a (patch)
tree3b8d72cbf4bfb5c2aef091e111aecff61063f5f6 /src/datastore
parente22f7eb50d960e9b67cbf782afb9fb833362072c (diff)
downloadgnunet-8852f5f8ff3d521897175ddeb711d6b77e03fa8a.tar.gz
gnunet-8852f5f8ff3d521897175ddeb711d6b77e03fa8a.zip
Fixing #1976 by allowing allocations between INT_MAX and SIZE_MAX and at the same time limiting BF size for datastore to 2 GB. Also fixing infinite loop when creating BFs of sizes between 2-4 GB
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/gnunet-service-datastore.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c
index be88d288e..327244ffd 100644
--- a/src/datastore/gnunet-service-datastore.c
+++ b/src/datastore/gnunet-service-datastore.c
@@ -1492,7 +1492,10 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1492 cache_size = quota / 8; /* Or should we make this an option? */ 1492 cache_size = quota / 8; /* Or should we make this an option? */
1493 GNUNET_STATISTICS_set (stats, gettext_noop ("# cache size"), cache_size, 1493 GNUNET_STATISTICS_set (stats, gettext_noop ("# cache size"), cache_size,
1494 GNUNET_NO); 1494 GNUNET_NO);
1495 bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */ 1495 if (quota / 32LL > (1 << 31))
1496 bf_size = (1 << 31); /* absolute limit: ~2 GB, beyond that BF just won't help anyway */
1497 else
1498 bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */
1496 fn = NULL; 1499 fn = NULL;
1497 if ((GNUNET_OK != 1500 if ((GNUNET_OK !=
1498 GNUNET_CONFIGURATION_get_value_filename (cfg, "DATASTORE", "BLOOMFILTER", 1501 GNUNET_CONFIGURATION_get_value_filename (cfg, "DATASTORE", "BLOOMFILTER",