gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] 02/02: fix datacache bytes stored calculation


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 02/02: fix datacache bytes stored calculation
Date: Sun, 06 May 2018 21:16:49 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

commit c51a44aa2181e66ff4d529ba89c1177b0abc37de
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun May 6 21:16:46 2018 +0200

    fix datacache bytes stored calculation
---
 src/datacache/datacache.c               | 40 ++++++++++++++++++++++-----------
 src/datacache/plugin_datacache_sqlite.c |  3 ++-
 2 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/src/datacache/datacache.c b/src/datacache/datacache.c
index 92cc40b53..0646019bd 100644
--- a/src/datacache/datacache.c
+++ b/src/datacache/datacache.c
@@ -170,10 +170,14 @@ GNUNET_DATACACHE_create (const struct 
GNUNET_CONFIGURATION_Handle *cfg,
   ret = GNUNET_new (struct GNUNET_DATACACHE_Handle);
 
   if (GNUNET_YES !=
-      GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "DISABLE_BF"))
+      GNUNET_CONFIGURATION_get_value_yesno (cfg,
+                                            section,
+                                            "DISABLE_BF"))
   {
     if (GNUNET_YES !=
-       GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "DISABLE_BF_RC"))
+       GNUNET_CONFIGURATION_get_value_yesno (cfg,
+                                              section,
+                                              "DISABLE_BF_RC"))
     {
       ret->bloom_name = GNUNET_DISK_mktemp ("gnunet-datacachebloom");
     }
@@ -230,7 +234,9 @@ GNUNET_DATACACHE_destroy (struct GNUNET_DATACACHE_Handle *h)
   if (NULL != h->filter)
     GNUNET_CONTAINER_bloomfilter_free (h->filter);
   if (NULL != h->api)
-    GNUNET_break (NULL == GNUNET_PLUGIN_unload (h->lib_name, h->api));
+    GNUNET_break (NULL ==
+                  GNUNET_PLUGIN_unload (h->lib_name,
+                                        h->api));
   GNUNET_free (h->lib_name);
   GNUNET_free (h->short_name);
   GNUNET_free (h->section);
@@ -243,7 +249,8 @@ GNUNET_DATACACHE_destroy (struct GNUNET_DATACACHE_Handle *h)
                                      h->bloom_name);
     GNUNET_free (h->bloom_name);
   }
-  GNUNET_STATISTICS_destroy (h->stats, GNUNET_NO);
+  GNUNET_STATISTICS_destroy (h->stats,
+                             GNUNET_NO);
   GNUNET_free (h);
 }
 
@@ -273,10 +280,14 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h,
 {
   ssize_t used;
 
-  used = h->api->put (h->api->cls, key,
-                     data_size, data,
-                     type, discard_time,
-                     path_info_len, path_info);
+  used = h->api->put (h->api->cls,
+                      key,
+                     data_size,
+                      data,
+                     type,
+                      discard_time,
+                     path_info_len,
+                      path_info);
   if (-1 == used)
   {
     GNUNET_break (0);
@@ -290,16 +301,17 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h,
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Stored data under key `%s' in cache\n",
        GNUNET_h2s (key));
+  if (NULL != h->filter)
+    GNUNET_CONTAINER_bloomfilter_add (h->filter,
+                                      key);
   GNUNET_STATISTICS_update (h->stats,
                             gettext_noop ("# bytes stored"),
-                            data_size,
+                            used,
                             GNUNET_NO);
   GNUNET_STATISTICS_update (h->stats,
                             gettext_noop ("# items stored"),
                             1,
                             GNUNET_NO);
-  if (NULL != h->filter)
-    GNUNET_CONTAINER_bloomfilter_add (h->filter, key);
   while (h->utilization + used > h->env.quota)
     GNUNET_assert (GNUNET_OK == h->api->del (h->api->cls));
   h->utilization += used;
@@ -345,8 +357,10 @@ GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h,
     return 0;                   /* can not be present */
   }
   return h->api->get (h->api->cls,
-                      key, type,
-                      iter, iter_cls);
+                      key,
+                      type,
+                      iter,
+                      iter_cls);
 }
 
 
diff --git a/src/datacache/plugin_datacache_sqlite.c 
b/src/datacache/plugin_datacache_sqlite.c
index dd79d0125..15438b29b 100644
--- a/src/datacache/plugin_datacache_sqlite.c
+++ b/src/datacache/plugin_datacache_sqlite.c
@@ -138,7 +138,8 @@ sq_prepare (sqlite3 *dbh,
   char *dummy;
 
   return sqlite3_prepare (dbh,
-                          zSql, strlen (zSql),
+                          zSql,
+                          strlen (zSql),
                           ppStmt,
                           (const char **) &dummy);
 }

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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