From f9c2936425e8c1cfff2e7b07a3588de270628880 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Wed, 11 Mar 2015 18:02:26 +0000 Subject: [PATCH] -fixes --- src/gns/plugin_rest_gns.c | 21 ++++++++++++++++++++- src/rest/gnunet-rest-server.c | 2 -- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c index d5d6788c8..2dc140b37 100644 --- a/src/gns/plugin_rest_gns.c +++ b/src/gns/plugin_rest_gns.c @@ -220,6 +220,7 @@ process_lookup_result (void *cls, uint32_t rd_count, const char *typename; char *string_val; char *result; + const char *exp_str; json_t *result_root; json_t *result_name; json_t *result_array; @@ -254,6 +255,24 @@ process_lookup_result (void *cls, uint32_t rd_count, record_obj = json_object(); json_object_set_new (record_obj, "type", json_string (typename)); json_object_set_new (record_obj, "value", json_string (string_val)); + + if (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION & rd[i].flags) + { + struct GNUNET_TIME_Relative time_rel; + time_rel.rel_value_us = rd[i].expiration_time; + exp_str = GNUNET_STRINGS_relative_time_to_string (time_rel, 1); + } + else + { + struct GNUNET_TIME_Absolute time_abs; + time_abs.abs_value_us = rd[i].expiration_time; + exp_str = GNUNET_STRINGS_absolute_time_to_string (time_abs); + } + json_object_set_new (record_obj, "expiration_time", json_string (exp_str)); + + json_object_set_new (record_obj, "expired", + json_boolean (GNUNET_YES == GNUNET_GNSRECORD_is_expired (&(rd[i])))); + json_array_append (result_array, record_obj); json_decref (record_obj); } @@ -262,7 +281,7 @@ process_lookup_result (void *cls, uint32_t rd_count, json_object_set (result_root, "query_result", result_array); json_decref (result_array); result = json_dumps (result_root, JSON_COMPACT); - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Result %s\n", result); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); json_decref (result_root); handle->proc (handle->proc_cls, result, strlen (result), GNUNET_OK); GNUNET_free (result); diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c index 26ca8f5cd..01913ef53 100644 --- a/src/rest/gnunet-rest-server.c +++ b/src/rest/gnunet-rest-server.c @@ -256,8 +256,6 @@ create_response (void *cls, } return MHD_YES; } - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Size %d\n", *upload_data_size); if (GN_REST_STATE_INIT == con_handle->state) { if (0 != *upload_data_size) -- 2.25.1