aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/gnunet-service-namestore.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-04-29 10:56:15 +0200
committerChristian Grothoff <christian@grothoff.org>2018-04-29 10:56:15 +0200
commitce2864cfaa27e55096b480bf35db5f8cee2a5e7e (patch)
treebe47c017d1467870000aa1a507eab3c995304179 /src/namestore/gnunet-service-namestore.c
parent823215c974ccb1ef3cad9eb1082999cd1b910416 (diff)
downloadgnunet-ce2864cfaa27e55096b480bf35db5f8cee2a5e7e.tar.gz
gnunet-ce2864cfaa27e55096b480bf35db5f8cee2a5e7e.zip
add option to disable namecache, add velocity calculation and delay correction to zonemaster, fix some ftbfs from recent NAMESTORE API change
Diffstat (limited to 'src/namestore/gnunet-service-namestore.c')
-rw-r--r--src/namestore/gnunet-service-namestore.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 06a50132b..b9061ed9f 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -257,6 +257,12 @@ static struct GNUNET_NotificationContext *monitor_nc;
257 */ 257 */
258static int cache_keys; 258static int cache_keys;
259 259
260/**
261 * Use the namecache? Doing so creates additional cryptographic
262 * operations whenever we touch a record.
263 */
264static int disable_namecache;
265
260 266
261/** 267/**
262 * Task run during shutdown. 268 * Task run during shutdown.
@@ -281,8 +287,11 @@ cleanup_task (void *cls)
281 cop); 287 cop);
282 GNUNET_free (cop); 288 GNUNET_free (cop);
283 } 289 }
284 GNUNET_NAMECACHE_disconnect (namecache); 290 if (NULL != namecache)
285 namecache = NULL; 291 {
292 GNUNET_NAMECACHE_disconnect (namecache);
293 namecache = NULL;
294 }
286 GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name, 295 GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name,
287 GSN_database)); 296 GSN_database));
288 GNUNET_free (db_lib_name); 297 GNUNET_free (db_lib_name);
@@ -715,6 +724,14 @@ refresh_block (struct NamestoreClient *nc,
715 rid); 724 rid);
716 return; /* no data, no need to update cache */ 725 return; /* no data, no need to update cache */
717 } 726 }
727 if (GNUNET_YES == disable_namecache)
728 {
729 GNUNET_STATISTICS_update (statistics,
730 "Namecache updates skipped (NC disabled)",
731 1,
732 GNUNET_NO);
733 return;
734 }
718 exp_time = GNUNET_GNSRECORD_record_get_expiration_time (res_count, 735 exp_time = GNUNET_GNSRECORD_record_get_expiration_time (res_count,
719 res); 736 res);
720 if (cache_keys) 737 if (cache_keys)
@@ -1692,13 +1709,20 @@ run (void *cls,
1692 (void) service; 1709 (void) service;
1693 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1710 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1694 "Starting namestore service\n"); 1711 "Starting namestore service\n");
1695 GSN_cfg = cfg;
1696 monitor_nc = GNUNET_notification_context_create (1);
1697 namecache = GNUNET_NAMECACHE_connect (cfg);
1698 /* Loading database plugin */
1699 cache_keys = GNUNET_CONFIGURATION_get_value_yesno (cfg, 1712 cache_keys = GNUNET_CONFIGURATION_get_value_yesno (cfg,
1700 "namestore", 1713 "namestore",
1701 "CACHE_KEYS"); 1714 "CACHE_KEYS");
1715 disable_namecache = GNUNET_CONFIGURATION_get_value_yesno (cfg,
1716 "namecache",
1717 "DISABLE");
1718 GSN_cfg = cfg;
1719 monitor_nc = GNUNET_notification_context_create (1);
1720 if (GNUNET_NO == disable_namecache)
1721 {
1722 namecache = GNUNET_NAMECACHE_connect (cfg);
1723 GNUNET_assert (NULL != namecache);
1724 }
1725 /* Loading database plugin */
1702 if (GNUNET_OK != 1726 if (GNUNET_OK !=
1703 GNUNET_CONFIGURATION_get_value_string (cfg, 1727 GNUNET_CONFIGURATION_get_value_string (cfg,
1704 "namestore", 1728 "namestore",