gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13422 - in gnunet/src: hello hostlist


From: gnunet
Subject: [GNUnet-SVN] r13422 - in gnunet/src: hello hostlist
Date: Wed, 27 Oct 2010 11:48:46 +0200

Author: wachs
Date: 2010-10-27 11:48:46 +0200 (Wed, 27 Oct 2010)
New Revision: 13422

Modified:
   gnunet/src/hello/hello.c
   gnunet/src/hostlist/hostlist-client.c
   gnunet/src/hostlist/hostlist-server.c
Log:
Refactoring gnunet time


Modified: gnunet/src/hello/hello.c
===================================================================
--- gnunet/src/hello/hello.c    2010-10-27 09:47:07 UTC (rev 13421)
+++ gnunet/src/hello/hello.c    2010-10-27 09:48:46 UTC (rev 13422)
@@ -329,8 +329,8 @@
   ec.tname = tname;
   GNUNET_HELLO_iterate_addresses (mc->other, GNUNET_NO, &get_match_exp, &ec);
   if ( (ec.found == GNUNET_NO) ||
-       (ec.expiration.value < expiration.value) ||
-       ( (ec.expiration.value == expiration.value) &&
+       (ec.expiration.abs_value < expiration.abs_value) ||
+       ( (ec.expiration.abs_value == expiration.abs_value) &&
         (mc->take_equal == GNUNET_YES) ) )
     {
       mc->ret += GNUNET_HELLO_add_address (tname,
@@ -413,8 +413,8 @@
   GNUNET_HELLO_iterate_addresses (dc->old_hello,
                                   GNUNET_NO, &get_match_exp, &ec);
   if ((ec.found == GNUNET_YES) &&
-      ((ec.expiration.value > expiration.value) ||
-       (ec.expiration.value >= dc->expiration_limit.value)))
+      ((ec.expiration.abs_value > expiration.abs_value) ||
+       (ec.expiration.abs_value >= dc->expiration_limit.abs_value)))
     return GNUNET_YES;          /* skip */
   ret = dc->it (dc->it_cls, tname, expiration, addr, addrlen);
   return ret;
@@ -560,7 +560,7 @@
 {
   struct EqualsContext *ec = cls;
 
-  if (expiration.value < ec->expiration_limit.value)
+  if (expiration.abs_value < ec->expiration_limit.abs_value)
     return GNUNET_YES;
   if ( (addrlen == ec->addrlen) && 
        (0 == strcmp (tname,
@@ -570,7 +570,7 @@
                     addrlen)) )
     {
       ec->found = GNUNET_YES;
-      if (expiration.value < ec->expiration.value)     
+      if (expiration.abs_value < ec->expiration.abs_value)     
        ec->result = GNUNET_TIME_absolute_min (expiration,
                                               ec->result);             
       return GNUNET_SYSERR;
@@ -587,7 +587,7 @@
 {
   struct EqualsContext *ec = cls;
 
-  if (expiration.value < ec->expiration_limit.value)
+  if (expiration.abs_value < ec->expiration_limit.abs_value)
     return GNUNET_YES;
   ec->tname = tname;
   ec->expiration = expiration;
@@ -642,8 +642,8 @@
                                   GNUNET_NO,
                                   &find_matching,
                                   &ec);
-  if (ec.result.value ==
-      GNUNET_TIME_UNIT_ZERO.value)
+  if (ec.result.abs_value ==
+      GNUNET_TIME_UNIT_ZERO.rel_value)
     return ec.result; 
   ec.h2 = h1;
   GNUNET_HELLO_iterate_addresses (h2,

Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c       2010-10-27 09:47:07 UTC (rev 
13421)
+++ gnunet/src/hostlist/hostlist-client.c       2010-10-27 09:48:46 UTC (rev 
13422)
@@ -810,7 +810,7 @@
       clean_up ();
       return;
     }
-  if (GNUNET_TIME_absolute_get_remaining (end_time).value == 0)
+  if (GNUNET_TIME_absolute_get_remaining (end_time).rel_value == 0)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                  _("Timeout trying to download hostlist from `%s'\n"),
@@ -1072,16 +1072,16 @@
     return; /* in shutdown */
   }
   delay = hostlist_delay;
-  if (hostlist_delay.value == 0)
+  if (hostlist_delay.rel_value == 0)
     hostlist_delay = GNUNET_TIME_UNIT_SECONDS;
   else
     hostlist_delay = GNUNET_TIME_relative_multiply (hostlist_delay, 2);
-  if (hostlist_delay.value > GNUNET_TIME_UNIT_HOURS.value * (1 + 
stat_connection_count))
+  if (hostlist_delay.rel_value > GNUNET_TIME_UNIT_HOURS.rel_value * (1 + 
stat_connection_count))
     hostlist_delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS,
                                                     (1 + 
stat_connection_count));
   GNUNET_STATISTICS_set (stats,
                          gettext_noop("# milliseconds between hostlist 
downloads"),
-                         hostlist_delay.value,
+                         hostlist_delay.rel_value,
                          GNUNET_YES);
   if (0 == once)
     {
@@ -1092,7 +1092,7 @@
               _("Have %u/%u connections.  Will consider downloading hostlist 
in %llums\n"),
               stat_connection_count,
               MIN_CONNECTIONS,
-              (unsigned long long) delay.value);
+              (unsigned long long) delay.rel_value);
   ti_check_download = GNUNET_SCHEDULER_add_delayed (sched,
                                                delay,
                                                &task_check,
@@ -1135,7 +1135,7 @@
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               _("Hostlists will be saved to file again in %llums\n"),
-              (unsigned long long) SAVING_INTERVALL.value);
+              (unsigned long long) SAVING_INTERVALL.rel_value);
   ti_saving_task = GNUNET_SCHEDULER_add_delayed (sched,
                                                SAVING_INTERVALL,
                                                &task_hostlist_saving,
@@ -1271,7 +1271,7 @@
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
             "Testing new hostlist advertisements is locked for the next %u 
ms\n",
-            TESTING_INTERVAL.value);
+            TESTING_INTERVAL.rel_value);
 
   ti_download_dispatcher_task = GNUNET_SCHEDULER_add_now (sched,
                                                      &task_download_dispatcher,
@@ -1315,7 +1315,7 @@
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
              _("Initial time between hostlist downloads is %llums\n"),
              (unsigned long long) value);
-  hostlist_delay.value = value;
+  hostlist_delay.rel_value = value;
   return GNUNET_OK;
 }
 
@@ -1384,8 +1384,8 @@
       hostlist->hostlist_uri = (const char *) &hostlist[1];
       memcpy (&hostlist[1], uri, strlen(uri)+1);
       hostlist->quality = quality;
-      hostlist->time_creation.value = created;
-      hostlist->time_last_usage.value = last_used;
+      hostlist->time_creation.abs_value = created;
+      hostlist->time_last_usage.abs_value = last_used;
       GNUNET_CONTAINER_DLL_insert(linked_list_head, linked_list_tail, 
hostlist);
       linked_list_size++;
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1472,9 +1472,9 @@
               (GNUNET_OK !=
                GNUNET_BIO_write_int64 (wh, pos->quality)) ||
                (GNUNET_OK !=
-                GNUNET_BIO_write_int64 (wh, pos->time_last_usage.value)) ||
+                GNUNET_BIO_write_int64 (wh, pos->time_last_usage.abs_value)) ||
                (GNUNET_OK !=
-                GNUNET_BIO_write_int64 (wh, pos->time_creation.value)) ||
+                GNUNET_BIO_write_int64 (wh, pos->time_creation.abs_value)) ||
               (GNUNET_OK !=
                GNUNET_BIO_write_int32 (wh, pos->hello_count)))
            {
@@ -1554,7 +1554,7 @@
     load_hostlist_file ();
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               _("Hostlists will be saved to file again in  %llums\n"),
-              (unsigned long long) SAVING_INTERVALL.value);
+              (unsigned long long) SAVING_INTERVALL.rel_value);
     ti_saving_task = GNUNET_SCHEDULER_add_delayed (sched,
                                                SAVING_INTERVALL,
                                                &task_hostlist_saving,

Modified: gnunet/src/hostlist/hostlist-server.c
===================================================================
--- gnunet/src/hostlist/hostlist-server.c       2010-10-27 09:47:07 UTC (rev 
13421)
+++ gnunet/src/hostlist/hostlist-server.c       2010-10-27 09:48:46 UTC (rev 
13422)
@@ -163,7 +163,7 @@
 {
   int *arg = cls;
 
-  if (GNUNET_TIME_absolute_get_remaining (expiration).value == 0)
+  if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value == 0)
     {
       GNUNET_STATISTICS_update (stats,
                                gettext_noop("expired addresses encountered"),
@@ -533,7 +533,7 @@
                                &max));
   haveto = MHD_get_timeout (daemon_handle, &timeout);
   if (haveto == MHD_YES)
-    tv.value = (uint64_t) timeout;
+    tv.rel_value = (uint64_t) timeout;
   else
     tv = GNUNET_TIME_UNIT_FOREVER_REL;
   GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]