aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-service-gns.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-08-21 15:18:42 +0000
committerChristian Grothoff <christian@grothoff.org>2013-08-21 15:18:42 +0000
commit76613c37258a7fef8764d127a5bda9cee6d05888 (patch)
tree8e0c452c7793ea4b43fd39a15c8c0bed005cead3 /src/gns/gnunet-service-gns.c
parent178fae8082be84bf68150762023ee7a181960ae0 (diff)
downloadgnunet-76613c37258a7fef8764d127a5bda9cee6d05888.tar.gz
gnunet-76613c37258a7fef8764d127a5bda9cee6d05888.zip
implement conversion to absolute TTL
Diffstat (limited to 'src/gns/gnunet-service-gns.c')
-rw-r--r--src/gns/gnunet-service-gns.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index 1760c6a34..583a5131a 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -22,10 +22,6 @@
22 * @brief GNUnet GNS service 22 * @brief GNUnet GNS service
23 * @author Martin Schanzenbach 23 * @author Martin Schanzenbach
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 *
26 * TODO:
27 * - perform conversion of relative expiration times to absolute time
28 * when going to DHT!
29 */ 25 */
30#include "platform.h" 26#include "platform.h"
31#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
@@ -332,6 +328,7 @@ put_gns_record (void *cls,
332 struct GNUNET_NAMESTORE_Block *block; 328 struct GNUNET_NAMESTORE_Block *block;
333 struct GNUNET_HashCode query; 329 struct GNUNET_HashCode query;
334 struct GNUNET_TIME_Absolute expire; 330 struct GNUNET_TIME_Absolute expire;
331 struct GNUNET_TIME_Absolute now;
335 size_t block_size; 332 size_t block_size;
336 struct GNUNET_NAMESTORE_RecordData rd_public[rd_count]; 333 struct GNUNET_NAMESTORE_RecordData rd_public[rd_count];
337 unsigned int rd_public_count; 334 unsigned int rd_public_count;
@@ -387,13 +384,22 @@ put_gns_record (void *cls,
387 return; 384 return;
388 } 385 }
389 386
390 /* filter out records that are not public! */ 387 /* filter out records that are not public, and convert to
388 absolute expiration time. */
391 rd_public_count = 0; 389 rd_public_count = 0;
390 now = GNUNET_TIME_absolute_get ();
392 for (i=0;i<rd_count;i++) 391 for (i=0;i<rd_count;i++)
393 if (0 == (rd[i].flags & (GNUNET_NAMESTORE_RF_PRIVATE | 392 if (0 == (rd[i].flags & (GNUNET_NAMESTORE_RF_PRIVATE |
394 GNUNET_NAMESTORE_RF_PENDING))) 393 GNUNET_NAMESTORE_RF_PENDING)))
395 rd_public[rd_public_count++] = rd[i]; 394 {
396 395 rd_public[rd_public_count] = rd[i];
396 if (0 != (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION))
397 {
398 rd_public[rd_public_count].flags &= ~GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION;
399 rd_public[rd_public_count].expiration_time += now.abs_value_us;
400 }
401 rd_public_count++;
402 }
397 403
398 /* We got a set of records to publish */ 404 /* We got a set of records to publish */
399 if (0 == rd_public_count) 405 if (0 == rd_public_count)