From 2c589fcdf9eb24144786b8800cbba1c99a9452e8 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Mon, 9 May 2022 09:00:52 +0200 Subject: FCFSD: Allow configuration of relative expiration time of added records --- src/namestore/gnunet-namestore-fcfsd.c | 20 ++++++++++++++++++-- src/namestore/namestore.conf.in | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c index 5b13e50ff..7e96ffa43 100644 --- a/src/namestore/gnunet-namestore-fcfsd.c +++ b/src/namestore/gnunet-namestore-fcfsd.c @@ -164,6 +164,11 @@ static struct StaticPage *notfound_page = NULL; */ static struct StaticPage *forbidden_page = NULL; +/** + * The relative expiration time for added records + */ +static struct GNUNET_TIME_Relative record_exp; + /** * Task ran at shutdown to clean up everything. * @@ -532,8 +537,8 @@ register_do_cb (void *cls, } gd.data = gdraw; - gd.expiration_time = UINT64_MAX; - gd.flags = GNUNET_GNSRECORD_RF_NONE; + gd.expiration_time = record_exp.rel_value_us; + gd.flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; rd->searching = GNUNET_NAMESTORE_records_store (namestore, zone_key, @@ -1062,6 +1067,17 @@ run_service (void *cls, GNUNET_log_setup ("fcfsd", "WARNING", NULL); + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg, + "fcfsd", + "RELATIVE_RECORD_EXPIRATION", + &record_exp)) + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + _("No expiration specified for records.\n")); + GNUNET_SCHEDULER_shutdown (); + return; + } + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "fcfsd", "HTTPPORT", diff --git a/src/namestore/namestore.conf.in b/src/namestore/namestore.conf.in index 733e4e2f8..a9c928c66 100644 --- a/src/namestore/namestore.conf.in +++ b/src/namestore/namestore.conf.in @@ -44,6 +44,7 @@ gns = gnunet-namestore -e 1a -u BINARY = gnunet-namestore-fcfsd START_ON_DEMAND = NO UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-fcfsd.sock +RELATIVE_RECORD_EXPIRATION = 7 d # On what port does the FCFS daemon listen for HTTP clients? HTTPPORT = 18080 -- cgit v1.2.3