diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-11 21:21:56 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-11 21:21:56 +0000 |
commit | 3d7fefedc9ba60bd8e8448efe8b628446d958536 (patch) | |
tree | 61ce41a52cd6e7232cead77818ef265993b2427e /src/hostlist | |
parent | 4a0398474db197abed243a123fb971fbeeffab4b (diff) | |
download | gnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.tar.gz gnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.zip |
changing time measurement from milliseconds to microseconds
Diffstat (limited to 'src/hostlist')
-rw-r--r-- | src/hostlist/hostlist-client.c | 29 | ||||
-rw-r--r-- | src/hostlist/hostlist-server.c | 4 |
2 files changed, 19 insertions, 14 deletions
diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c index ad9b2b0b5..713d3cb04 100644 --- a/src/hostlist/hostlist-client.c +++ b/src/hostlist/hostlist-client.c | |||
@@ -793,7 +793,7 @@ task_download (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
793 | clean_up (); | 793 | clean_up (); |
794 | return; | 794 | return; |
795 | } | 795 | } |
796 | if (GNUNET_TIME_absolute_get_remaining (end_time).rel_value == 0) | 796 | if (0 == GNUNET_TIME_absolute_get_remaining (end_time).rel_value_us) |
797 | { | 797 | { |
798 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 798 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
799 | _("Timeout trying to download hostlist from `%s'\n"), | 799 | _("Timeout trying to download hostlist from `%s'\n"), |
@@ -1023,19 +1023,20 @@ task_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1023 | GNUNET_SCHEDULER_add_now (&task_download_dispatcher, NULL); | 1023 | GNUNET_SCHEDULER_add_now (&task_download_dispatcher, NULL); |
1024 | 1024 | ||
1025 | delay = hostlist_delay; | 1025 | delay = hostlist_delay; |
1026 | if (hostlist_delay.rel_value == 0) | 1026 | if (0 == hostlist_delay.rel_value_us) |
1027 | hostlist_delay = GNUNET_TIME_UNIT_SECONDS; | 1027 | hostlist_delay = GNUNET_TIME_UNIT_SECONDS; |
1028 | else | 1028 | else |
1029 | hostlist_delay = GNUNET_TIME_relative_multiply (hostlist_delay, 2); | 1029 | hostlist_delay = GNUNET_TIME_relative_multiply (hostlist_delay, 2); |
1030 | if (hostlist_delay.rel_value > | 1030 | if (hostlist_delay.rel_value_us > |
1031 | GNUNET_TIME_UNIT_HOURS.rel_value * (1 + stat_connection_count)) | 1031 | GNUNET_TIME_UNIT_HOURS.rel_value_us * (1 + stat_connection_count)) |
1032 | hostlist_delay = | 1032 | hostlist_delay = |
1033 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, | 1033 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, |
1034 | (1 + stat_connection_count)); | 1034 | (1 + stat_connection_count)); |
1035 | GNUNET_STATISTICS_set (stats, | 1035 | GNUNET_STATISTICS_set (stats, |
1036 | gettext_noop | 1036 | gettext_noop |
1037 | ("# milliseconds between hostlist downloads"), | 1037 | ("# milliseconds between hostlist downloads"), |
1038 | hostlist_delay.rel_value, GNUNET_YES); | 1038 | hostlist_delay.rel_value_us / 1000LL, |
1039 | GNUNET_YES); | ||
1039 | if (0 == once) | 1040 | if (0 == once) |
1040 | { | 1041 | { |
1041 | delay = GNUNET_TIME_UNIT_ZERO; | 1042 | delay = GNUNET_TIME_UNIT_ZERO; |
@@ -1194,8 +1195,9 @@ handler_advertisement (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1194 | &task_testing_intervall_reset, NULL); | 1195 | &task_testing_intervall_reset, NULL); |
1195 | 1196 | ||
1196 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1197 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1197 | "Testing new hostlist advertisements is locked for the next %u ms\n", | 1198 | "Testing new hostlist advertisements is locked for the next %s\n", |
1198 | TESTING_INTERVAL.rel_value); | 1199 | GNUNET_STRINGS_relative_time_to_string (TESTING_INTERVAL, |
1200 | GNUNET_YES)); | ||
1199 | 1201 | ||
1200 | ti_download_dispatcher_task = | 1202 | ti_download_dispatcher_task = |
1201 | GNUNET_SCHEDULER_add_now (&task_download_dispatcher, NULL); | 1203 | GNUNET_SCHEDULER_add_now (&task_download_dispatcher, NULL); |
@@ -1223,11 +1225,14 @@ primary_task (void *cls, int success) | |||
1223 | } | 1225 | } |
1224 | 1226 | ||
1225 | 1227 | ||
1228 | /** | ||
1229 | * @param value previous delay value, in milliseconds (!) | ||
1230 | */ | ||
1226 | static int | 1231 | static int |
1227 | process_stat (void *cls, const char *subsystem, const char *name, | 1232 | process_stat (void *cls, const char *subsystem, const char *name, |
1228 | uint64_t value, int is_persistent) | 1233 | uint64_t value, int is_persistent) |
1229 | { | 1234 | { |
1230 | hostlist_delay.rel_value = value; | 1235 | hostlist_delay.rel_value_us = value * 1000LL; |
1231 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1236 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1232 | "Initial time between hostlist downloads is %s\n", | 1237 | "Initial time between hostlist downloads is %s\n", |
1233 | GNUNET_STRINGS_relative_time_to_string (hostlist_delay, GNUNET_YES)); | 1238 | GNUNET_STRINGS_relative_time_to_string (hostlist_delay, GNUNET_YES)); |
@@ -1298,8 +1303,8 @@ load_hostlist_file () | |||
1298 | hostlist->hostlist_uri = (const char *) &hostlist[1]; | 1303 | hostlist->hostlist_uri = (const char *) &hostlist[1]; |
1299 | memcpy (&hostlist[1], uri, strlen (uri) + 1); | 1304 | memcpy (&hostlist[1], uri, strlen (uri) + 1); |
1300 | hostlist->quality = quality; | 1305 | hostlist->quality = quality; |
1301 | hostlist->time_creation.abs_value = created; | 1306 | hostlist->time_creation.abs_value_us = created; |
1302 | hostlist->time_last_usage.abs_value = last_used; | 1307 | hostlist->time_last_usage.abs_value_us = last_used; |
1303 | GNUNET_CONTAINER_DLL_insert (linked_list_head, linked_list_tail, hostlist); | 1308 | GNUNET_CONTAINER_DLL_insert (linked_list_head, linked_list_tail, hostlist); |
1304 | linked_list_size++; | 1309 | linked_list_size++; |
1305 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1310 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1382,9 +1387,9 @@ save_hostlist_file (int shutdown) | |||
1382 | (GNUNET_OK != GNUNET_BIO_write_int32 (wh, pos->times_used)) || | 1387 | (GNUNET_OK != GNUNET_BIO_write_int32 (wh, pos->times_used)) || |
1383 | (GNUNET_OK != GNUNET_BIO_write_int64 (wh, pos->quality)) || | 1388 | (GNUNET_OK != GNUNET_BIO_write_int64 (wh, pos->quality)) || |
1384 | (GNUNET_OK != | 1389 | (GNUNET_OK != |
1385 | GNUNET_BIO_write_int64 (wh, pos->time_last_usage.abs_value)) || | 1390 | GNUNET_BIO_write_int64 (wh, pos->time_last_usage.abs_value_us)) || |
1386 | (GNUNET_OK != | 1391 | (GNUNET_OK != |
1387 | GNUNET_BIO_write_int64 (wh, pos->time_creation.abs_value)) || | 1392 | GNUNET_BIO_write_int64 (wh, pos->time_creation.abs_value_us)) || |
1388 | (GNUNET_OK != GNUNET_BIO_write_int32 (wh, pos->hello_count))) | 1393 | (GNUNET_OK != GNUNET_BIO_write_int32 (wh, pos->hello_count))) |
1389 | { | 1394 | { |
1390 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1395 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c index b9e1e6cf1..031c7a13e 100644 --- a/src/hostlist/hostlist-server.c +++ b/src/hostlist/hostlist-server.c | |||
@@ -155,7 +155,7 @@ check_has_addr (void *cls, const struct GNUNET_HELLO_Address *address, | |||
155 | { | 155 | { |
156 | int *arg = cls; | 156 | int *arg = cls; |
157 | 157 | ||
158 | if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value == 0) | 158 | if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us) |
159 | { | 159 | { |
160 | GNUNET_STATISTICS_update (stats, | 160 | GNUNET_STATISTICS_update (stats, |
161 | gettext_noop ("expired addresses encountered"), 1, | 161 | gettext_noop ("expired addresses encountered"), 1, |
@@ -504,7 +504,7 @@ prepare_daemon (struct MHD_Daemon *daemon_handle) | |||
504 | GNUNET_assert (MHD_YES == MHD_get_fdset (daemon_handle, &rs, &ws, &es, &max)); | 504 | GNUNET_assert (MHD_YES == MHD_get_fdset (daemon_handle, &rs, &ws, &es, &max)); |
505 | haveto = MHD_get_timeout (daemon_handle, &timeout); | 505 | haveto = MHD_get_timeout (daemon_handle, &timeout); |
506 | if (haveto == MHD_YES) | 506 | if (haveto == MHD_YES) |
507 | tv.rel_value = (uint64_t) timeout; | 507 | tv.rel_value_us = (uint64_t) timeout; |
508 | else | 508 | else |
509 | tv = GNUNET_TIME_UNIT_FOREVER_REL; | 509 | tv = GNUNET_TIME_UNIT_FOREVER_REL; |
510 | GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); | 510 | GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); |