diff options
author | Nils Gillmann <ng0@n0.is> | 2018-05-06 19:24:34 +0000 |
---|---|---|
committer | Nils Gillmann <ng0@n0.is> | 2018-05-06 19:24:34 +0000 |
commit | 964f78df05ce848b96908ad0b931dfec1e182348 (patch) | |
tree | fcf38993afd9827b0310f4ec4025e836c7ca11e7 | |
parent | e5784b3cbad55508a240b1f6e183964cc5b999ef (diff) | |
parent | c51a44aa2181e66ff4d529ba89c1177b0abc37de (diff) | |
download | gnunet-964f78df05ce848b96908ad0b931dfec1e182348.tar.gz gnunet-964f78df05ce848b96908ad0b931dfec1e182348.zip |
Merge branch 'master' of gnunet.org:gnunet
-rw-r--r-- | src/datacache/datacache.c | 40 | ||||
-rw-r--r-- | src/datacache/plugin_datacache_sqlite.c | 3 | ||||
-rw-r--r-- | src/dht/gnunet_dht_profiler.c | 6 |
3 files changed, 32 insertions, 17 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, | |||
170 | ret = GNUNET_new (struct GNUNET_DATACACHE_Handle); | 170 | ret = GNUNET_new (struct GNUNET_DATACACHE_Handle); |
171 | 171 | ||
172 | if (GNUNET_YES != | 172 | if (GNUNET_YES != |
173 | GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "DISABLE_BF")) | 173 | GNUNET_CONFIGURATION_get_value_yesno (cfg, |
174 | section, | ||
175 | "DISABLE_BF")) | ||
174 | { | 176 | { |
175 | if (GNUNET_YES != | 177 | if (GNUNET_YES != |
176 | GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "DISABLE_BF_RC")) | 178 | GNUNET_CONFIGURATION_get_value_yesno (cfg, |
179 | section, | ||
180 | "DISABLE_BF_RC")) | ||
177 | { | 181 | { |
178 | ret->bloom_name = GNUNET_DISK_mktemp ("gnunet-datacachebloom"); | 182 | ret->bloom_name = GNUNET_DISK_mktemp ("gnunet-datacachebloom"); |
179 | } | 183 | } |
@@ -230,7 +234,9 @@ GNUNET_DATACACHE_destroy (struct GNUNET_DATACACHE_Handle *h) | |||
230 | if (NULL != h->filter) | 234 | if (NULL != h->filter) |
231 | GNUNET_CONTAINER_bloomfilter_free (h->filter); | 235 | GNUNET_CONTAINER_bloomfilter_free (h->filter); |
232 | if (NULL != h->api) | 236 | if (NULL != h->api) |
233 | GNUNET_break (NULL == GNUNET_PLUGIN_unload (h->lib_name, h->api)); | 237 | GNUNET_break (NULL == |
238 | GNUNET_PLUGIN_unload (h->lib_name, | ||
239 | h->api)); | ||
234 | GNUNET_free (h->lib_name); | 240 | GNUNET_free (h->lib_name); |
235 | GNUNET_free (h->short_name); | 241 | GNUNET_free (h->short_name); |
236 | GNUNET_free (h->section); | 242 | GNUNET_free (h->section); |
@@ -243,7 +249,8 @@ GNUNET_DATACACHE_destroy (struct GNUNET_DATACACHE_Handle *h) | |||
243 | h->bloom_name); | 249 | h->bloom_name); |
244 | GNUNET_free (h->bloom_name); | 250 | GNUNET_free (h->bloom_name); |
245 | } | 251 | } |
246 | GNUNET_STATISTICS_destroy (h->stats, GNUNET_NO); | 252 | GNUNET_STATISTICS_destroy (h->stats, |
253 | GNUNET_NO); | ||
247 | GNUNET_free (h); | 254 | GNUNET_free (h); |
248 | } | 255 | } |
249 | 256 | ||
@@ -273,10 +280,14 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, | |||
273 | { | 280 | { |
274 | ssize_t used; | 281 | ssize_t used; |
275 | 282 | ||
276 | used = h->api->put (h->api->cls, key, | 283 | used = h->api->put (h->api->cls, |
277 | data_size, data, | 284 | key, |
278 | type, discard_time, | 285 | data_size, |
279 | path_info_len, path_info); | 286 | data, |
287 | type, | ||
288 | discard_time, | ||
289 | path_info_len, | ||
290 | path_info); | ||
280 | if (-1 == used) | 291 | if (-1 == used) |
281 | { | 292 | { |
282 | GNUNET_break (0); | 293 | GNUNET_break (0); |
@@ -290,16 +301,17 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, | |||
290 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 301 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
291 | "Stored data under key `%s' in cache\n", | 302 | "Stored data under key `%s' in cache\n", |
292 | GNUNET_h2s (key)); | 303 | GNUNET_h2s (key)); |
304 | if (NULL != h->filter) | ||
305 | GNUNET_CONTAINER_bloomfilter_add (h->filter, | ||
306 | key); | ||
293 | GNUNET_STATISTICS_update (h->stats, | 307 | GNUNET_STATISTICS_update (h->stats, |
294 | gettext_noop ("# bytes stored"), | 308 | gettext_noop ("# bytes stored"), |
295 | data_size, | 309 | used, |
296 | GNUNET_NO); | 310 | GNUNET_NO); |
297 | GNUNET_STATISTICS_update (h->stats, | 311 | GNUNET_STATISTICS_update (h->stats, |
298 | gettext_noop ("# items stored"), | 312 | gettext_noop ("# items stored"), |
299 | 1, | 313 | 1, |
300 | GNUNET_NO); | 314 | GNUNET_NO); |
301 | if (NULL != h->filter) | ||
302 | GNUNET_CONTAINER_bloomfilter_add (h->filter, key); | ||
303 | while (h->utilization + used > h->env.quota) | 315 | while (h->utilization + used > h->env.quota) |
304 | GNUNET_assert (GNUNET_OK == h->api->del (h->api->cls)); | 316 | GNUNET_assert (GNUNET_OK == h->api->del (h->api->cls)); |
305 | h->utilization += used; | 317 | h->utilization += used; |
@@ -345,8 +357,10 @@ GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h, | |||
345 | return 0; /* can not be present */ | 357 | return 0; /* can not be present */ |
346 | } | 358 | } |
347 | return h->api->get (h->api->cls, | 359 | return h->api->get (h->api->cls, |
348 | key, type, | 360 | key, |
349 | iter, iter_cls); | 361 | type, |
362 | iter, | ||
363 | iter_cls); | ||
350 | } | 364 | } |
351 | 365 | ||
352 | 366 | ||
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, | |||
138 | char *dummy; | 138 | char *dummy; |
139 | 139 | ||
140 | return sqlite3_prepare (dbh, | 140 | return sqlite3_prepare (dbh, |
141 | zSql, strlen (zSql), | 141 | zSql, |
142 | strlen (zSql), | ||
142 | ppStmt, | 143 | ppStmt, |
143 | (const char **) &dummy); | 144 | (const char **) &dummy); |
144 | } | 145 | } |
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c index 12e99f65d..bc75b67f5 100644 --- a/src/dht/gnunet_dht_profiler.c +++ b/src/dht/gnunet_dht_profiler.c | |||
@@ -360,11 +360,11 @@ bandwidth_stats_cont (void *cls, | |||
360 | const char *emsg) | 360 | const char *emsg) |
361 | { | 361 | { |
362 | MESSAGE ("# Outgoing bandwidth: %llu\n", | 362 | MESSAGE ("# Outgoing bandwidth: %llu\n", |
363 | (unsigned long long) outgoing_bandwidth); | 363 | (unsigned long long) outgoing_bandwidth); |
364 | MESSAGE ("# Incoming bandwidth: %llu\n", | 364 | MESSAGE ("# Incoming bandwidth: %llu\n", |
365 | (unsigned long long) incoming_bandwidth); | 365 | (unsigned long long) incoming_bandwidth); |
366 | fprintf (stderr, | 366 | fprintf (stderr, |
367 | "Benchmark done. Collect data via gnunet-statisics, then press ENTER to exit.\n"); | 367 | "Benchmark done. Collect data via gnunet-statistics, then press ENTER to exit.\n"); |
368 | getchar (); | 368 | getchar (); |
369 | GNUNET_SCHEDULER_shutdown (); | 369 | GNUNET_SCHEDULER_shutdown (); |
370 | } | 370 | } |