diff options
Diffstat (limited to 'src/namestore')
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 36 | ||||
-rw-r--r-- | src/namestore/gnunet-zoneimport.c | 16 | ||||
-rw-r--r-- | src/namestore/plugin_namestore_flat.c | 2 |
3 files changed, 39 insertions, 15 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 | */ |
258 | static int cache_keys; | 258 | static int cache_keys; |
259 | 259 | ||
260 | /** | ||
261 | * Use the namecache? Doing so creates additional cryptographic | ||
262 | * operations whenever we touch a record. | ||
263 | */ | ||
264 | static 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", |
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c index 503262487..55779e06a 100644 --- a/src/namestore/gnunet-zoneimport.c +++ b/src/namestore/gnunet-zoneimport.c | |||
@@ -951,10 +951,10 @@ store_completed_cb (void *cls, | |||
951 | 951 | ||
952 | delta = GNUNET_TIME_absolute_get_duration (last); | 952 | delta = GNUNET_TIME_absolute_get_duration (last); |
953 | last = GNUNET_TIME_absolute_get (); | 953 | last = GNUNET_TIME_absolute_get (); |
954 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 954 | fprintf (stderr, |
955 | "Processed 1000 records in %s\n", | 955 | "Processed 1000 records in %s\n", |
956 | GNUNET_STRINGS_relative_time_to_string (delta, | 956 | GNUNET_STRINGS_relative_time_to_string (delta, |
957 | GNUNET_YES)); | 957 | GNUNET_YES)); |
958 | } | 958 | } |
959 | } | 959 | } |
960 | free_records (req); | 960 | free_records (req); |
@@ -1590,10 +1590,10 @@ process_stdin (void *cls) | |||
1590 | 1590 | ||
1591 | delta = GNUNET_TIME_absolute_get_duration (last); | 1591 | delta = GNUNET_TIME_absolute_get_duration (last); |
1592 | last = GNUNET_TIME_absolute_get (); | 1592 | last = GNUNET_TIME_absolute_get (); |
1593 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1593 | fprintf (stderr, |
1594 | "Imported 1000 records in %s\n", | 1594 | "Imported 1000 records in %s\n", |
1595 | GNUNET_STRINGS_relative_time_to_string (delta, | 1595 | GNUNET_STRINGS_relative_time_to_string (delta, |
1596 | GNUNET_YES)); | 1596 | GNUNET_YES)); |
1597 | } | 1597 | } |
1598 | queue (hn); | 1598 | queue (hn); |
1599 | } | 1599 | } |
diff --git a/src/namestore/plugin_namestore_flat.c b/src/namestore/plugin_namestore_flat.c index e9ed1cc4f..f061ab7d1 100644 --- a/src/namestore/plugin_namestore_flat.c +++ b/src/namestore/plugin_namestore_flat.c | |||
@@ -583,7 +583,7 @@ iterate_zones (void *cls, | |||
583 | (void) key; | 583 | (void) key; |
584 | if (0 == ic->limit) | 584 | if (0 == ic->limit) |
585 | return GNUNET_NO; | 585 | return GNUNET_NO; |
586 | if ( (NULL != it->zone) && | 586 | if ( (NULL != ic->zone) && |
587 | (0 != memcmp (entry->private_key, | 587 | (0 != memcmp (entry->private_key, |
588 | ic->zone, | 588 | ic->zone, |
589 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) ) | 589 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) ) |