From 4c297e9d83087fef43bb3c6cb89b8787b5d7bdc9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 4 Oct 2013 05:49:34 +0000 Subject: [PATCH] -add logic to print expiration times for records --- src/namestore/gnunet-namestore.c | 18 ++++++++++++++++-- src/namestore/gnunet-service-namestore.c | 2 +- src/namestore/test_namestore_lookup.sh | 1 - 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index 617604359..47018e2ec 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c @@ -326,6 +326,9 @@ display_record (void *cls, const char *typestring; char *s; unsigned int i; + const char *ets; + struct GNUNET_TIME_Absolute at; + struct GNUNET_TIME_Relative rt; if (NULL == name) { @@ -352,10 +355,21 @@ display_record (void *cls, (unsigned int) rd[i].record_type); continue; } + if (0 != (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) + { + rt.rel_value_us = rd[i].expiration_time; + ets = GNUNET_STRINGS_relative_time_to_string (rt, GNUNET_YES); + } + else + { + at.abs_value_us = rd[i].expiration_time; + ets = GNUNET_STRINGS_absolute_time_to_string (at); + } FPRINTF (stdout, - "\t%s: %s\n", + "\t%s: %s (%s)\n", typestring, - s); + s, + ets); GNUNET_free (s); } FPRINTF (stdout, "%s", "\n"); diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index b39d3858c..7ca043d8a 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -443,7 +443,7 @@ handle_lookup_block (void *cls, * Handles a #GNUNET_MESSAGE_TYPE_NAMESTORE_BLOCK_CACHE message * * @param cls unused - * @param client GNUNET_SERVER_Client sending the message + * @param client client sending the message * @param message message of type 'struct BlockCacheMessage' */ static void diff --git a/src/namestore/test_namestore_lookup.sh b/src/namestore/test_namestore_lookup.sh index 99757b102..681af7d96 100755 --- a/src/namestore/test_namestore_lookup.sh +++ b/src/namestore/test_namestore_lookup.sh @@ -3,7 +3,6 @@ CONFIGURATION="test_namestore_api.conf" trap "gnunet-arm -e -c $CONFIGURATION" SIGINT rm -rf `gnunet-config -c $CONFIGURATION -s PATHS -o SERVICEHOME` TEST_IP_PLUS="127.0.0.1" -TEST_RECORD_NAME_PLUS="www" TEST_RECORD_NAME_DNS="www3" which timeout &> /dev/null && DO_TIMEOUT="timeout 5" -- 2.25.1