aboutsummaryrefslogtreecommitdiff
path: root/src/hostlist
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-10-27 09:48:46 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-10-27 09:48:46 +0000
commitba9ef31948175e08469403cfd8840db7efe5886f (patch)
treeafff54135d797e25c3c1819e67e8be0adc7f9ec1 /src/hostlist
parent92ea81543438aebee77ceec02800da3e4da6a421 (diff)
downloadgnunet-ba9ef31948175e08469403cfd8840db7efe5886f.tar.gz
gnunet-ba9ef31948175e08469403cfd8840db7efe5886f.zip
Refactoring gnunet time
Diffstat (limited to 'src/hostlist')
-rw-r--r--src/hostlist/hostlist-client.c26
-rw-r--r--src/hostlist/hostlist-server.c4
2 files changed, 15 insertions, 15 deletions
diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c
index 61e79c6cf..a5d345b60 100644
--- a/src/hostlist/hostlist-client.c
+++ b/src/hostlist/hostlist-client.c
@@ -810,7 +810,7 @@ task_download (void *cls,
810 clean_up (); 810 clean_up ();
811 return; 811 return;
812 } 812 }
813 if (GNUNET_TIME_absolute_get_remaining (end_time).value == 0) 813 if (GNUNET_TIME_absolute_get_remaining (end_time).rel_value == 0)
814 { 814 {
815 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 815 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
816 _("Timeout trying to download hostlist from `%s'\n"), 816 _("Timeout trying to download hostlist from `%s'\n"),
@@ -1072,16 +1072,16 @@ task_check (void *cls,
1072 return; /* in shutdown */ 1072 return; /* in shutdown */
1073 } 1073 }
1074 delay = hostlist_delay; 1074 delay = hostlist_delay;
1075 if (hostlist_delay.value == 0) 1075 if (hostlist_delay.rel_value == 0)
1076 hostlist_delay = GNUNET_TIME_UNIT_SECONDS; 1076 hostlist_delay = GNUNET_TIME_UNIT_SECONDS;
1077 else 1077 else
1078 hostlist_delay = GNUNET_TIME_relative_multiply (hostlist_delay, 2); 1078 hostlist_delay = GNUNET_TIME_relative_multiply (hostlist_delay, 2);
1079 if (hostlist_delay.value > GNUNET_TIME_UNIT_HOURS.value * (1 + stat_connection_count)) 1079 if (hostlist_delay.rel_value > GNUNET_TIME_UNIT_HOURS.rel_value * (1 + stat_connection_count))
1080 hostlist_delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 1080 hostlist_delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS,
1081 (1 + stat_connection_count)); 1081 (1 + stat_connection_count));
1082 GNUNET_STATISTICS_set (stats, 1082 GNUNET_STATISTICS_set (stats,
1083 gettext_noop("# milliseconds between hostlist downloads"), 1083 gettext_noop("# milliseconds between hostlist downloads"),
1084 hostlist_delay.value, 1084 hostlist_delay.rel_value,
1085 GNUNET_YES); 1085 GNUNET_YES);
1086 if (0 == once) 1086 if (0 == once)
1087 { 1087 {
@@ -1092,7 +1092,7 @@ task_check (void *cls,
1092 _("Have %u/%u connections. Will consider downloading hostlist in %llums\n"), 1092 _("Have %u/%u connections. Will consider downloading hostlist in %llums\n"),
1093 stat_connection_count, 1093 stat_connection_count,
1094 MIN_CONNECTIONS, 1094 MIN_CONNECTIONS,
1095 (unsigned long long) delay.value); 1095 (unsigned long long) delay.rel_value);
1096 ti_check_download = GNUNET_SCHEDULER_add_delayed (sched, 1096 ti_check_download = GNUNET_SCHEDULER_add_delayed (sched,
1097 delay, 1097 delay,
1098 &task_check, 1098 &task_check,
@@ -1135,7 +1135,7 @@ task_hostlist_saving (void *cls,
1135 1135
1136 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1136 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1137 _("Hostlists will be saved to file again in %llums\n"), 1137 _("Hostlists will be saved to file again in %llums\n"),
1138 (unsigned long long) SAVING_INTERVALL.value); 1138 (unsigned long long) SAVING_INTERVALL.rel_value);
1139 ti_saving_task = GNUNET_SCHEDULER_add_delayed (sched, 1139 ti_saving_task = GNUNET_SCHEDULER_add_delayed (sched,
1140 SAVING_INTERVALL, 1140 SAVING_INTERVALL,
1141 &task_hostlist_saving, 1141 &task_hostlist_saving,
@@ -1271,7 +1271,7 @@ handler_advertisement (void *cls,
1271 1271
1272 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1272 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1273 "Testing new hostlist advertisements is locked for the next %u ms\n", 1273 "Testing new hostlist advertisements is locked for the next %u ms\n",
1274 TESTING_INTERVAL.value); 1274 TESTING_INTERVAL.rel_value);
1275 1275
1276 ti_download_dispatcher_task = GNUNET_SCHEDULER_add_now (sched, 1276 ti_download_dispatcher_task = GNUNET_SCHEDULER_add_now (sched,
1277 &task_download_dispatcher, 1277 &task_download_dispatcher,
@@ -1315,7 +1315,7 @@ process_stat (void *cls,
1315 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1315 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1316 _("Initial time between hostlist downloads is %llums\n"), 1316 _("Initial time between hostlist downloads is %llums\n"),
1317 (unsigned long long) value); 1317 (unsigned long long) value);
1318 hostlist_delay.value = value; 1318 hostlist_delay.rel_value = value;
1319 return GNUNET_OK; 1319 return GNUNET_OK;
1320} 1320}
1321 1321
@@ -1384,8 +1384,8 @@ load_hostlist_file ()
1384 hostlist->hostlist_uri = (const char *) &hostlist[1]; 1384 hostlist->hostlist_uri = (const char *) &hostlist[1];
1385 memcpy (&hostlist[1], uri, strlen(uri)+1); 1385 memcpy (&hostlist[1], uri, strlen(uri)+1);
1386 hostlist->quality = quality; 1386 hostlist->quality = quality;
1387 hostlist->time_creation.value = created; 1387 hostlist->time_creation.abs_value = created;
1388 hostlist->time_last_usage.value = last_used; 1388 hostlist->time_last_usage.abs_value = last_used;
1389 GNUNET_CONTAINER_DLL_insert(linked_list_head, linked_list_tail, hostlist); 1389 GNUNET_CONTAINER_DLL_insert(linked_list_head, linked_list_tail, hostlist);
1390 linked_list_size++; 1390 linked_list_size++;
1391 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1391 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1472,9 +1472,9 @@ static void save_hostlist_file ( int shutdown )
1472 (GNUNET_OK != 1472 (GNUNET_OK !=
1473 GNUNET_BIO_write_int64 (wh, pos->quality)) || 1473 GNUNET_BIO_write_int64 (wh, pos->quality)) ||
1474 (GNUNET_OK != 1474 (GNUNET_OK !=
1475 GNUNET_BIO_write_int64 (wh, pos->time_last_usage.value)) || 1475 GNUNET_BIO_write_int64 (wh, pos->time_last_usage.abs_value)) ||
1476 (GNUNET_OK != 1476 (GNUNET_OK !=
1477 GNUNET_BIO_write_int64 (wh, pos->time_creation.value)) || 1477 GNUNET_BIO_write_int64 (wh, pos->time_creation.abs_value)) ||
1478 (GNUNET_OK != 1478 (GNUNET_OK !=
1479 GNUNET_BIO_write_int32 (wh, pos->hello_count))) 1479 GNUNET_BIO_write_int32 (wh, pos->hello_count)))
1480 { 1480 {
@@ -1554,7 +1554,7 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c,
1554 load_hostlist_file (); 1554 load_hostlist_file ();
1555 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1555 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1556 _("Hostlists will be saved to file again in %llums\n"), 1556 _("Hostlists will be saved to file again in %llums\n"),
1557 (unsigned long long) SAVING_INTERVALL.value); 1557 (unsigned long long) SAVING_INTERVALL.rel_value);
1558 ti_saving_task = GNUNET_SCHEDULER_add_delayed (sched, 1558 ti_saving_task = GNUNET_SCHEDULER_add_delayed (sched,
1559 SAVING_INTERVALL, 1559 SAVING_INTERVALL,
1560 &task_hostlist_saving, 1560 &task_hostlist_saving,
diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c
index d8c8db476..8fdee5545 100644
--- a/src/hostlist/hostlist-server.c
+++ b/src/hostlist/hostlist-server.c
@@ -163,7 +163,7 @@ check_has_addr (void *cls,
163{ 163{
164 int *arg = cls; 164 int *arg = cls;
165 165
166 if (GNUNET_TIME_absolute_get_remaining (expiration).value == 0) 166 if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value == 0)
167 { 167 {
168 GNUNET_STATISTICS_update (stats, 168 GNUNET_STATISTICS_update (stats,
169 gettext_noop("expired addresses encountered"), 169 gettext_noop("expired addresses encountered"),
@@ -533,7 +533,7 @@ prepare_daemon (struct MHD_Daemon *daemon_handle)
533 &max)); 533 &max));
534 haveto = MHD_get_timeout (daemon_handle, &timeout); 534 haveto = MHD_get_timeout (daemon_handle, &timeout);
535 if (haveto == MHD_YES) 535 if (haveto == MHD_YES)
536 tv.value = (uint64_t) timeout; 536 tv.rel_value = (uint64_t) timeout;
537 else 537 else
538 tv = GNUNET_TIME_UNIT_FOREVER_REL; 538 tv = GNUNET_TIME_UNIT_FOREVER_REL;
539 GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); 539 GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1);