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 | |
parent | 4a0398474db197abed243a123fb971fbeeffab4b (diff) | |
download | gnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.tar.gz gnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.zip |
changing time measurement from milliseconds to microseconds
Diffstat (limited to 'src')
173 files changed, 1432 insertions, 1216 deletions
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c index 4a68a97ea..85cb1f45d 100644 --- a/src/arm/gnunet-arm.c +++ b/src/arm/gnunet-arm.c | |||
@@ -547,7 +547,7 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
547 | { | 547 | { |
548 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Termination action\n"); | 548 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Termination action\n"); |
549 | GNUNET_ARM_request_service_stop (h, term, | 549 | GNUNET_ARM_request_service_stop (h, term, |
550 | (0 == timeout.rel_value) ? STOP_TIMEOUT : timeout, | 550 | (0 == timeout.rel_value_us) ? STOP_TIMEOUT : timeout, |
551 | &term_callback, NULL); | 551 | &term_callback, NULL); |
552 | return; | 552 | return; |
553 | } | 553 | } |
@@ -557,7 +557,7 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
557 | { | 557 | { |
558 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "End action\n"); | 558 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "End action\n"); |
559 | GNUNET_ARM_request_service_stop (h, "arm", | 559 | GNUNET_ARM_request_service_stop (h, "arm", |
560 | (0 == timeout.rel_value) ? STOP_TIMEOUT_ARM : timeout, | 560 | (0 == timeout.rel_value_us) ? STOP_TIMEOUT_ARM : timeout, |
561 | &stop_callback, NULL); | 561 | &stop_callback, NULL); |
562 | return; | 562 | return; |
563 | } | 563 | } |
@@ -569,7 +569,7 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
569 | GNUNET_ARM_request_service_start (h, "arm", | 569 | GNUNET_ARM_request_service_start (h, "arm", |
570 | (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) | | 570 | (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) | |
571 | (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR), | 571 | (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR), |
572 | (0 == timeout.rel_value) ? START_TIMEOUT: timeout, | 572 | (0 == timeout.rel_value_us) ? START_TIMEOUT: timeout, |
573 | start_callback, NULL); | 573 | start_callback, NULL); |
574 | return; | 574 | return; |
575 | } | 575 | } |
@@ -579,7 +579,7 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
579 | { | 579 | { |
580 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Initialization action\n"); | 580 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Initialization action\n"); |
581 | GNUNET_ARM_request_service_start (h, init, GNUNET_OS_INHERIT_STD_NONE, | 581 | GNUNET_ARM_request_service_start (h, init, GNUNET_OS_INHERIT_STD_NONE, |
582 | (0 == timeout.rel_value) ? STOP_TIMEOUT : timeout, | 582 | (0 == timeout.rel_value_us) ? STOP_TIMEOUT : timeout, |
583 | &init_callback, NULL); | 583 | &init_callback, NULL); |
584 | return; | 584 | return; |
585 | } | 585 | } |
@@ -590,7 +590,7 @@ action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
590 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 590 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
591 | "Going to list all running services controlled by ARM.\n"); | 591 | "Going to list all running services controlled by ARM.\n"); |
592 | GNUNET_ARM_request_service_list (h, | 592 | GNUNET_ARM_request_service_list (h, |
593 | (0 == timeout.rel_value) ? LIST_TIMEOUT : timeout, | 593 | (0 == timeout.rel_value_us) ? LIST_TIMEOUT : timeout, |
594 | &list_callback, &list); | 594 | &list_callback, &list); |
595 | return; | 595 | return; |
596 | } | 596 | } |
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index 1acb82f72..f5426e176 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c | |||
@@ -1012,8 +1012,7 @@ delayed_restart_task (void *cls, | |||
1012 | if (NULL != sl->proc) | 1012 | if (NULL != sl->proc) |
1013 | continue; | 1013 | continue; |
1014 | /* service is currently not running */ | 1014 | /* service is currently not running */ |
1015 | if (GNUNET_TIME_absolute_get_remaining (sl->restart_at).rel_value == | 1015 | if (0 == GNUNET_TIME_absolute_get_remaining (sl->restart_at).rel_value_us) |
1016 | 0) | ||
1017 | { | 1016 | { |
1018 | /* restart is now allowed */ | 1017 | /* restart is now allowed */ |
1019 | if (sl->is_default) | 1018 | if (sl->is_default) |
@@ -1046,7 +1045,7 @@ delayed_restart_task (void *cls, | |||
1046 | (sl->restart_at)); | 1045 | (sl->restart_at)); |
1047 | } | 1046 | } |
1048 | } | 1047 | } |
1049 | if (lowestRestartDelay.rel_value != GNUNET_TIME_UNIT_FOREVER_REL.rel_value) | 1048 | if (lowestRestartDelay.rel_value_us != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) |
1050 | { | 1049 | { |
1051 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1050 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1052 | "Will restart process in %s\n", | 1051 | "Will restart process in %s\n", |
@@ -1126,7 +1125,7 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1126 | statstr = _( /* process termination method */ "unknown"); | 1125 | statstr = _( /* process termination method */ "unknown"); |
1127 | statcode = 0; | 1126 | statcode = 0; |
1128 | } | 1127 | } |
1129 | if (0 != pos->killed_at.abs_value) | 1128 | if (0 != pos->killed_at.abs_value_us) |
1130 | { | 1129 | { |
1131 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1130 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1132 | _("Service `%s' took %s to terminate\n"), | 1131 | _("Service `%s' took %s to terminate\n"), |
@@ -1149,7 +1148,7 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1149 | if ((statusType == GNUNET_OS_PROCESS_EXITED) && (statcode == 0)) | 1148 | if ((statusType == GNUNET_OS_PROCESS_EXITED) && (statcode == 0)) |
1150 | { | 1149 | { |
1151 | /* process terminated normally, allow restart at any time */ | 1150 | /* process terminated normally, allow restart at any time */ |
1152 | pos->restart_at.abs_value = 0; | 1151 | pos->restart_at.abs_value_us = 0; |
1153 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1152 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1154 | _("Service `%s' terminated normally, will restart at any time\n"), | 1153 | _("Service `%s' terminated normally, will restart at any time\n"), |
1155 | pos->name); | 1154 | pos->name); |
diff --git a/src/arm/test_exponential_backoff.c b/src/arm/test_exponential_backoff.c index c61bc2eec..7d8d771a2 100644 --- a/src/arm/test_exponential_backoff.c +++ b/src/arm/test_exponential_backoff.c | |||
@@ -250,7 +250,7 @@ kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
250 | } | 250 | } |
251 | else | 251 | else |
252 | { | 252 | { |
253 | waitedFor.rel_value = 0; | 253 | waitedFor.rel_value_us = 0; |
254 | } | 254 | } |
255 | /* Connect to the doNothing task */ | 255 | /* Connect to the doNothing task */ |
256 | doNothingConnection = GNUNET_CLIENT_connect ("do-nothing", cfg); | 256 | doNothingConnection = GNUNET_CLIENT_connect ("do-nothing", cfg); |
@@ -261,7 +261,7 @@ kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
261 | { | 261 | { |
262 | GNUNET_CLIENT_disconnect (doNothingConnection); | 262 | GNUNET_CLIENT_disconnect (doNothingConnection); |
263 | GNUNET_ARM_request_service_stop (arm, "do-nothing", TIMEOUT, NULL, NULL); | 263 | GNUNET_ARM_request_service_stop (arm, "do-nothing", TIMEOUT, NULL, NULL); |
264 | if (waitedFor_prev.rel_value >= waitedFor.rel_value) | 264 | if (waitedFor_prev.rel_value_us >= waitedFor.rel_value_us) |
265 | ok = 9; | 265 | ok = 9; |
266 | else | 266 | else |
267 | ok = 0; | 267 | ok = 0; |
diff --git a/src/ats/gnunet-service-ats-solver_mlp.c b/src/ats/gnunet-service-ats-solver_mlp.c index 84cacd017..93c6839f8 100644 --- a/src/ats/gnunet-service-ats-solver_mlp.c +++ b/src/ats/gnunet-service-ats-solver_mlp.c | |||
@@ -1078,7 +1078,7 @@ GAS_mlp_solve_problem (void *solver) | |||
1078 | else | 1078 | else |
1079 | { | 1079 | { |
1080 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Problem was updated, resolving\n"); | 1080 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Problem was updated, resolving\n"); |
1081 | duration_build.rel_value = 0; | 1081 | duration_build.rel_value_us = 0; |
1082 | } | 1082 | } |
1083 | 1083 | ||
1084 | /* Run LP solver */ | 1084 | /* Run LP solver */ |
@@ -1107,10 +1107,15 @@ GAS_mlp_solve_problem (void *solver) | |||
1107 | mlp->ps.p_rows = glp_get_num_rows (mlp->p.prob); | 1107 | mlp->ps.p_rows = glp_get_num_rows (mlp->p.prob); |
1108 | mlp->ps.p_elements = mlp->p.num_elements; | 1108 | mlp->ps.p_elements = mlp->p.num_elements; |
1109 | 1109 | ||
1110 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Execution time: Build %llu ms, LP %llu ms, MLP %llu ms\n", | 1110 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1111 | (unsigned long long) duration_build.rel_value, | 1111 | "Execution time: Build %s\n", |
1112 | (unsigned long long) duration_lp.rel_value, | 1112 | GNUNET_STRINGS_relative_time_to_string (duration_build, GNUNET_NO)); |
1113 | (unsigned long long) duration_mlp.rel_value); | 1113 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1114 | "Execution time: LP %s\n", | ||
1115 | GNUNET_STRINGS_relative_time_to_string (duration_lp, GNUNET_NO)); | ||
1116 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1117 | "Execution time: MLP %s\n", | ||
1118 | GNUNET_STRINGS_relative_time_to_string (duration_mlp, GNUNET_NO)); | ||
1114 | 1119 | ||
1115 | /* Propagate result*/ | 1120 | /* Propagate result*/ |
1116 | if ((GNUNET_OK == res_lp) && (GNUNET_OK == res_mip)) | 1121 | if ((GNUNET_OK == res_lp) && (GNUNET_OK == res_mip)) |
@@ -1120,7 +1125,7 @@ GAS_mlp_solve_problem (void *solver) | |||
1120 | if (GNUNET_YES == mlp->write_mip_mps) | 1125 | if (GNUNET_YES == mlp->write_mip_mps) |
1121 | { | 1126 | { |
1122 | /* Write problem to disk */ | 1127 | /* Write problem to disk */ |
1123 | GNUNET_asprintf (&filename, "problem_p_%u_a%u_%llu.mps", mlp->p.num_peers, mlp->p.num_addresses, time.abs_value); | 1128 | GNUNET_asprintf (&filename, "problem_p_%u_a%u_%llu.mps", mlp->p.num_peers, mlp->p.num_addresses, time.abs_value_us); |
1124 | LOG (GNUNET_ERROR_TYPE_ERROR, "DUMP: %s \n", filename); | 1129 | LOG (GNUNET_ERROR_TYPE_ERROR, "DUMP: %s \n", filename); |
1125 | glp_write_lp(mlp->p.prob, NULL, filename); | 1130 | glp_write_lp(mlp->p.prob, NULL, filename); |
1126 | GNUNET_free (filename); | 1131 | GNUNET_free (filename); |
@@ -1128,7 +1133,7 @@ GAS_mlp_solve_problem (void *solver) | |||
1128 | if (GNUNET_YES == mlp->write_mip_sol) | 1133 | if (GNUNET_YES == mlp->write_mip_sol) |
1129 | { | 1134 | { |
1130 | /* Write solution to disk */ | 1135 | /* Write solution to disk */ |
1131 | GNUNET_asprintf (&filename, "problem_p_%u_a%u_%llu.sol", mlp->p.num_peers, mlp->p.num_addresses, time.abs_value); | 1136 | GNUNET_asprintf (&filename, "problem_p_%u_a%u_%llu.sol", mlp->p.num_peers, mlp->p.num_addresses, time.abs_value_us); |
1132 | glp_print_mip (mlp->p.prob, filename ); | 1137 | glp_print_mip (mlp->p.prob, filename ); |
1133 | LOG (GNUNET_ERROR_TYPE_ERROR, "DUMP: %s \n", filename); | 1138 | LOG (GNUNET_ERROR_TYPE_ERROR, "DUMP: %s \n", filename); |
1134 | GNUNET_free (filename); | 1139 | GNUNET_free (filename); |
@@ -1965,7 +1970,7 @@ GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1965 | mlp->control_param_lp.msg_lev = GLP_MSG_ALL; | 1970 | mlp->control_param_lp.msg_lev = GLP_MSG_ALL; |
1966 | #endif | 1971 | #endif |
1967 | mlp->control_param_lp.it_lim = max_iterations; | 1972 | mlp->control_param_lp.it_lim = max_iterations; |
1968 | mlp->control_param_lp.tm_lim = max_duration.rel_value; | 1973 | mlp->control_param_lp.tm_lim = max_duration.rel_value_us / 1000LL; |
1969 | 1974 | ||
1970 | /* Init MLP solving parameters */ | 1975 | /* Init MLP solving parameters */ |
1971 | glp_init_iocp(&mlp->control_param_mlp); | 1976 | glp_init_iocp(&mlp->control_param_mlp); |
@@ -1973,7 +1978,7 @@ GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1973 | #if VERBOSE_GLPK | 1978 | #if VERBOSE_GLPK |
1974 | mlp->control_param_mlp.msg_lev = GLP_MSG_ALL; | 1979 | mlp->control_param_mlp.msg_lev = GLP_MSG_ALL; |
1975 | #endif | 1980 | #endif |
1976 | mlp->control_param_mlp.tm_lim = max_duration.rel_value; | 1981 | mlp->control_param_mlp.tm_lim = max_duration.rel_value_us / 1000LL; |
1977 | 1982 | ||
1978 | LOG (GNUNET_ERROR_TYPE_DEBUG, "solver ready\n"); | 1983 | LOG (GNUNET_ERROR_TYPE_DEBUG, "solver ready\n"); |
1979 | 1984 | ||
diff --git a/src/ats/gnunet-service-ats-solver_proportional.c b/src/ats/gnunet-service-ats-solver_proportional.c index a48714855..1a1d5cad4 100644 --- a/src/ats/gnunet-service-ats-solver_proportional.c +++ b/src/ats/gnunet-service-ats-solver_proportional.c | |||
@@ -596,13 +596,14 @@ find_best_address_it (void *cls, const struct GNUNET_HashCode * key, void *value | |||
596 | 596 | ||
597 | now = GNUNET_TIME_absolute_get(); | 597 | now = GNUNET_TIME_absolute_get(); |
598 | 598 | ||
599 | if (current->blocked_until.abs_value == GNUNET_TIME_absolute_max (now, current->blocked_until).abs_value) | 599 | if (current->blocked_until.abs_value_us == GNUNET_TIME_absolute_max (now, current->blocked_until).abs_value_us) |
600 | { | 600 | { |
601 | /* This address is blocked for suggestion */ | 601 | /* This address is blocked for suggestion */ |
602 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 602 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
603 | "Address %p blocked for suggestion for %llu ms \n", | 603 | "Address %p blocked for suggestion for %s \n", |
604 | current, | 604 | current, |
605 | GNUNET_TIME_absolute_get_difference(now, current->blocked_until).rel_value); | 605 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (now, current->blocked_until), |
606 | GNUNET_YES)); | ||
606 | return GNUNET_OK; | 607 | return GNUNET_OK; |
607 | } | 608 | } |
608 | if (GNUNET_NO == is_bandwidth_available_in_network (net)) | 609 | if (GNUNET_NO == is_bandwidth_available_in_network (net)) |
diff --git a/src/ats/gnunet-service-ats_performance.c b/src/ats/gnunet-service-ats_performance.c index 4164e5f0d..f0986959c 100644 --- a/src/ats/gnunet-service-ats_performance.c +++ b/src/ats/gnunet-service-ats_performance.c | |||
@@ -582,7 +582,7 @@ GAS_handle_reservation_request (void *cls, struct GNUNET_SERVER_Client *client, | |||
582 | "RESERVATION_REQUEST"); | 582 | "RESERVATION_REQUEST"); |
583 | amount = (int32_t) ntohl (msg->amount); | 583 | amount = (int32_t) ntohl (msg->amount); |
584 | res_delay = GAS_reservations_reserve (&msg->peer, amount); | 584 | res_delay = GAS_reservations_reserve (&msg->peer, amount); |
585 | if (res_delay.rel_value > 0) | 585 | if (res_delay.rel_value_us > 0) |
586 | amount = 0; | 586 | amount = 0; |
587 | result.header.size = htons (sizeof (struct ReservationResultMessage)); | 587 | result.header.size = htons (sizeof (struct ReservationResultMessage)); |
588 | result.header.type = htons (GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT); | 588 | result.header.type = htons (GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT); |
diff --git a/src/ats/gnunet-service-ats_reservations.c b/src/ats/gnunet-service-ats_reservations.c index 3354c4e41..0b4948576 100644 --- a/src/ats/gnunet-service-ats_reservations.c +++ b/src/ats/gnunet-service-ats_reservations.c | |||
@@ -63,11 +63,13 @@ GAS_reservations_reserve (const struct GNUNET_PeerIdentity *peer, | |||
63 | if (amount >= 0) | 63 | if (amount >= 0) |
64 | { | 64 | { |
65 | ret = GNUNET_BANDWIDTH_tracker_get_delay (tracker, amount); | 65 | ret = GNUNET_BANDWIDTH_tracker_get_delay (tracker, amount); |
66 | if (ret.rel_value > 0) | 66 | if (ret.rel_value_us > 0) |
67 | { | 67 | { |
68 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 68 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
69 | "Delay to satisfy reservation for %d bytes is %llu ms\n", | 69 | "Delay to satisfy reservation for %d bytes is %s\n", |
70 | (int) amount, (unsigned long long) ret.rel_value); | 70 | (int) amount, |
71 | GNUNET_STRINGS_relative_time_to_string (ret, | ||
72 | GNUNET_YES)); | ||
71 | return ret; | 73 | return ret; |
72 | } | 74 | } |
73 | } | 75 | } |
diff --git a/src/ats/perf_ats_mlp.c b/src/ats/perf_ats_mlp.c index ada67fc94..5d370104b 100644 --- a/src/ats/perf_ats_mlp.c +++ b/src/ats/perf_ats_mlp.c | |||
@@ -366,39 +366,51 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
366 | } | 366 | } |
367 | if (GNUNET_NO == opt_numeric) | 367 | if (GNUNET_NO == opt_numeric) |
368 | { | 368 | { |
369 | fprintf (stderr, "Rebuild: %03u peers each %02u addresses; rebuild: LP/MIP state [%3s/%3s] presolv [%3s/%3s], (build/LP/MIP in ms) %04llu / %04llu / %04llu\n", | 369 | fprintf (stderr, |
370 | cp + 1, ca, | 370 | "Rebuild: %03u peers each %02u addresses; rebuild: LP/MIP state [%3s/%3s] presolv [%3s/%3s], (build/LP/MIP in us) %04llu / %04llu / %04llu\n", |
371 | (GNUNET_OK == full_lp_res) ? "OK" : "FAIL", | 371 | cp + 1, ca, |
372 | (GNUNET_OK == full_mip_res) ? "OK" : "FAIL", | 372 | (GNUNET_OK == full_lp_res) ? "OK" : "FAIL", |
373 | (GLP_YES == full_lp_presolv) ? "YES" : "NO", | 373 | (GNUNET_OK == full_mip_res) ? "OK" : "FAIL", |
374 | (GNUNET_OK == full_mip_presolv) ? "YES" : "NO", | 374 | (GLP_YES == full_lp_presolv) ? "YES" : "NO", |
375 | (unsigned long long) full_build_dur.rel_value, (unsigned long long) full_lp_dur.rel_value, (unsigned long long) full_mip_dur.rel_value); | 375 | (GNUNET_OK == full_mip_presolv) ? "YES" : "NO", |
376 | (unsigned long long) full_build_dur.rel_value_us, | ||
377 | (unsigned long long) full_lp_dur.rel_value_us, | ||
378 | (unsigned long long) full_mip_dur.rel_value_us); | ||
376 | if ((0 < opt_update_quantity) || (0 < opt_update_percent)) | 379 | if ((0 < opt_update_quantity) || (0 < opt_update_percent)) |
377 | fprintf (stderr, "Update : %03u peers each %02u addresses; rebuild: LP/MIP state [%3s/%3s] presolv [%3s/%3s], (build/LP/MIP in ms) %04llu / %04llu / %04llu\n", | 380 | fprintf (stderr, |
378 | cp + 1, ca, | 381 | "Update: %03u peers each %02u addresses; rebuild: LP/MIP state [%3s/%3s] presolv [%3s/%3s], (build/LP/MIP in us) %04llu / %04llu / %04llu\n", |
379 | (GNUNET_OK == update_lp_res) ? "OK" : "FAIL", | 382 | cp + 1, ca, |
380 | (GNUNET_OK == update_mip_res) ? "OK" : "FAIL", | 383 | (GNUNET_OK == update_lp_res) ? "OK" : "FAIL", |
381 | (GLP_YES == update_lp_presolv) ? "YES" : "NO", | 384 | (GNUNET_OK == update_mip_res) ? "OK" : "FAIL", |
382 | (GNUNET_OK == update_mip_presolv) ? "YES" : "NO", | 385 | (GLP_YES == update_lp_presolv) ? "YES" : "NO", |
383 | (unsigned long long) update_build_dur.rel_value, (unsigned long long) update_lp_dur.rel_value, (unsigned long long) update_mip_dur.rel_value); | 386 | (GNUNET_OK == update_mip_presolv) ? "YES" : "NO", |
387 | (unsigned long long) update_build_dur.rel_value_us, | ||
388 | (unsigned long long) update_lp_dur.rel_value_us, | ||
389 | (unsigned long long) update_mip_dur.rel_value_us); | ||
384 | } | 390 | } |
385 | else | 391 | else |
386 | { | 392 | { |
387 | fprintf (stderr, "Rebuild;%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu\n", | 393 | fprintf (stderr, |
388 | cp + 1, ca, | 394 | "Rebuild;%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu\n", |
389 | (GNUNET_OK == full_lp_res) ? "OK" : "FAIL", | 395 | cp + 1, ca, |
390 | (GNUNET_OK == full_mip_res) ? "OK" : "FAIL", | 396 | (GNUNET_OK == full_lp_res) ? "OK" : "FAIL", |
391 | (GLP_YES == full_lp_presolv) ? "YES" : "NO", | 397 | (GNUNET_OK == full_mip_res) ? "OK" : "FAIL", |
392 | (GNUNET_OK == full_mip_presolv) ? "YES" : "NO", | 398 | (GLP_YES == full_lp_presolv) ? "YES" : "NO", |
393 | (unsigned long long) full_build_dur.rel_value, (unsigned long long) full_lp_dur.rel_value, (unsigned long long) full_mip_dur.rel_value); | 399 | (GNUNET_OK == full_mip_presolv) ? "YES" : "NO", |
394 | if ((0 < opt_update_quantity) || (0 < opt_update_percent)) | 400 | (unsigned long long) full_build_dur.rel_value_us, |
395 | fprintf (stderr, "Update;%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu\n", | 401 | (unsigned long long) full_lp_dur.rel_value_us, |
396 | cp + 1, ca, | 402 | (unsigned long long) full_mip_dur.rel_value_us); |
397 | (GNUNET_OK == update_lp_res) ? "OK" : "FAIL", | 403 | if ((0 < opt_update_quantity) || (0 < opt_update_percent)) |
398 | (GNUNET_OK == update_mip_res) ? "OK" : "FAIL", | 404 | fprintf (stderr, |
399 | (GLP_YES == update_lp_presolv) ? "YES" : "NO", | 405 | "Update;%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu\n", |
400 | (GNUNET_OK == update_mip_presolv) ? "YES" : "NO", | 406 | cp + 1, ca, |
401 | (unsigned long long) update_build_dur.rel_value, (unsigned long long) update_lp_dur.rel_value, (unsigned long long) update_mip_dur.rel_value); | 407 | (GNUNET_OK == update_lp_res) ? "OK" : "FAIL", |
408 | (GNUNET_OK == update_mip_res) ? "OK" : "FAIL", | ||
409 | (GLP_YES == update_lp_presolv) ? "YES" : "NO", | ||
410 | (GNUNET_OK == update_mip_presolv) ? "YES" : "NO", | ||
411 | (unsigned long long) update_build_dur.rel_value_us, | ||
412 | (unsigned long long) update_lp_dur.rel_value_us, | ||
413 | (unsigned long long) update_mip_dur.rel_value_us); | ||
402 | } | 414 | } |
403 | } | 415 | } |
404 | } | 416 | } |
diff --git a/src/ats/test_ats_api_scheduling_block_and_reset.c b/src/ats/test_ats_api_scheduling_block_and_reset.c index b799a5de3..d5bd58031 100644 --- a/src/ats/test_ats_api_scheduling_block_and_reset.c +++ b/src/ats/test_ats_api_scheduling_block_and_reset.c | |||
@@ -150,44 +150,48 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
150 | if (3 == stage) | 150 | if (3 == stage) |
151 | { | 151 | { |
152 | /* Suggestion after resetting block interval */ | 152 | /* Suggestion after resetting block interval */ |
153 | reset_block_duration = GNUNET_TIME_absolute_get_difference(reset_block_start, GNUNET_TIME_absolute_get()); | 153 | reset_block_duration = GNUNET_TIME_absolute_get_difference (reset_block_start, |
154 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Address suggestion after resetting blocking took about %llu ms!\n", | 154 | GNUNET_TIME_absolute_get()); |
155 | (long long unsigned int) reset_block_duration.rel_value); | 155 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
156 | if ((block_duration.rel_value <= (initial_duration.rel_value * 3)) || | 156 | "Address suggestion after resetting blocking took about %s!\n", |
157 | (initial_duration.rel_value <= (block_duration.rel_value * 3))) | 157 | GNUNET_STRINGS_relative_time_to_string (reset_block_duration, |
158 | GNUNET_YES)); | ||
159 | if ((block_duration.rel_value_us <= (initial_duration.rel_value_us * 3)) || | ||
160 | (initial_duration.rel_value_us <= (block_duration.rel_value_us * 3))) | ||
158 | { | 161 | { |
159 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 162 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
160 | "Address suggestion after resetting blocking (%llu ms) took about the same as initial suggestion (%llu ms)\n", | 163 | "Address suggestion after resetting blocking took about the same as initial suggestion (%s)\n", |
161 | (long long unsigned int) reset_block_duration.rel_value, | 164 | GNUNET_STRINGS_relative_time_to_string (initial_duration, |
162 | (long long unsigned int) initial_duration.rel_value); | 165 | GNUNET_YES)); |
163 | ret = 0; | 166 | ret = 0; |
164 | } | 167 | } |
165 | else | 168 | else |
166 | { | 169 | { |
167 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Address suggestion after resetting blocking (%llu ms) has too big difference to initial suggestion (%llu ms)\n", | 170 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
168 | (long long unsigned int) reset_block_duration.rel_value, | 171 | "Address suggestion after resetting blocking has too big difference to initial suggestion (%s)\n", |
169 | (long long unsigned int) initial_duration.rel_value); | 172 | GNUNET_STRINGS_relative_time_to_string (initial_duration, |
173 | GNUNET_YES)); | ||
170 | ret = 1; | 174 | ret = 1; |
171 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 175 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
172 | GNUNET_SCHEDULER_add_now (&end, NULL); | 176 | GNUNET_SCHEDULER_add_now (&end, NULL); |
173 | return; | 177 | return; |
174 | } | 178 | } |
175 | 179 | ||
176 | if (((initial_duration.rel_value * 3) <= block_duration.rel_value ) && | 180 | if (((initial_duration.rel_value_us * 3) <= block_duration.rel_value_us) && |
177 | ((reset_block_duration.rel_value * 3) <= block_duration.rel_value)) | 181 | ((reset_block_duration.rel_value_us * 3) <= block_duration.rel_value_us)) |
178 | { | 182 | { |
179 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Address suggestion after resetting blocking (%llu ms) and initial suggestion (%llu ms) much faster than with blocking (%llu ms)\n", | 183 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
180 | (long long unsigned int) reset_block_duration.rel_value, | 184 | "Address suggestion after resetting blocking and initial suggestion (%llu us) much faster than with blocking (%llu us)\n", |
181 | (long long unsigned int) initial_duration.rel_value, | 185 | (unsigned long long) initial_duration.rel_value_us, |
182 | (long long unsigned int) block_duration.rel_value); | 186 | (unsigned long long) block_duration.rel_value_us); |
183 | ret = 0; | 187 | ret = 0; |
184 | } | 188 | } |
185 | else | 189 | else |
186 | { | 190 | { |
187 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Address suggestion after resetting blocking (%llu ms) and initial suggestion (%llu ms) not faster than with blocking (%llu ms)\n", | 191 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
188 | (long long unsigned int) reset_block_duration.rel_value, | 192 | "Address suggestion after resetting blocking and initial suggestion (%llu us) not faster than with blocking (%llu us)\n", |
189 | (long long unsigned int) initial_duration.rel_value, | 193 | (unsigned long long) initial_duration.rel_value_us, |
190 | (long long unsigned int) block_duration.rel_value); | 194 | (unsigned long long) block_duration.rel_value_us); |
191 | ret = 1; | 195 | ret = 1; |
192 | } | 196 | } |
193 | 197 | ||
@@ -200,18 +204,22 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
200 | { | 204 | { |
201 | /* Suggestion after block*/ | 205 | /* Suggestion after block*/ |
202 | block_duration = GNUNET_TIME_absolute_get_difference(block_start, GNUNET_TIME_absolute_get()); | 206 | block_duration = GNUNET_TIME_absolute_get_difference(block_start, GNUNET_TIME_absolute_get()); |
203 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Address suggestion was blocked for about %llu ms!\n", | 207 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
204 | (long long unsigned int) block_duration.rel_value); | 208 | "Address suggestion was blocked for about %s!\n", |
209 | GNUNET_STRINGS_relative_time_to_string (block_duration, | ||
210 | GNUNET_YES)); | ||
205 | 211 | ||
206 | if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) | 212 | if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) |
207 | { | 213 | { |
208 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stage %u: Callback with correct address `%s'\n", stage, | 214 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
215 | "Stage %u: Callback with correct address `%s'\n", stage, | ||
209 | GNUNET_i2s (&address->peer)); | 216 | GNUNET_i2s (&address->peer)); |
210 | ret = 0; | 217 | ret = 0; |
211 | } | 218 | } |
212 | else | 219 | else |
213 | { | 220 | { |
214 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stage %u: Callback with invalid address `%s'\n", stage, | 221 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
222 | "Stage %u: Callback with invalid address `%s'\n", stage, | ||
215 | GNUNET_i2s (&address->peer)); | 223 | GNUNET_i2s (&address->peer)); |
216 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 224 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
217 | GNUNET_SCHEDULER_add_now (&end, NULL); | 225 | GNUNET_SCHEDULER_add_now (&end, NULL); |
@@ -220,7 +228,8 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
220 | 228 | ||
221 | if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) | 229 | if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) |
222 | { | 230 | { |
223 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: Callback with incorrect ats info \n"); | 231 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
232 | "Stage %u: Callback with incorrect ats info \n"); | ||
224 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 233 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
225 | GNUNET_SCHEDULER_add_now (&end, NULL); | 234 | GNUNET_SCHEDULER_add_now (&end, NULL); |
226 | ret = 1; | 235 | ret = 1; |
@@ -237,13 +246,17 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
237 | /* Initial suggestion */ | 246 | /* Initial suggestion */ |
238 | if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) | 247 | if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) |
239 | { | 248 | { |
240 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stage %u: Callback with correct address `%s'\n", stage, | 249 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
250 | "Stage %u: Callback with correct address `%s'\n", | ||
251 | stage, | ||
241 | GNUNET_i2s (&address->peer)); | 252 | GNUNET_i2s (&address->peer)); |
242 | ret = 0; | 253 | ret = 0; |
243 | } | 254 | } |
244 | else | 255 | else |
245 | { | 256 | { |
246 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stage %u: Callback with invalid address `%s'\n", stage, | 257 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
258 | "Stage %u: Callback with invalid address `%s'\n", | ||
259 | stage, | ||
247 | GNUNET_i2s (&address->peer)); | 260 | GNUNET_i2s (&address->peer)); |
248 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 261 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
249 | GNUNET_SCHEDULER_add_now (&end, NULL); | 262 | GNUNET_SCHEDULER_add_now (&end, NULL); |
@@ -252,15 +265,20 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
252 | 265 | ||
253 | if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) | 266 | if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) |
254 | { | 267 | { |
255 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: Callback with incorrect ats info \n"); | 268 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
269 | "Stage %u: Callback with incorrect ats info\n", | ||
270 | stage); | ||
256 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 271 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
257 | GNUNET_SCHEDULER_add_now (&end, NULL); | 272 | GNUNET_SCHEDULER_add_now (&end, NULL); |
258 | ret = 1; | 273 | ret = 1; |
259 | } | 274 | } |
260 | stage ++; | 275 | stage++; |
261 | initial_duration = GNUNET_TIME_absolute_get_difference(initial_start, GNUNET_TIME_absolute_get()); | 276 | initial_duration = GNUNET_TIME_absolute_get_difference(initial_start, GNUNET_TIME_absolute_get()); |
262 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u: Initial suggestion took about %llu ms\n", stage, | 277 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
263 | (long long unsigned int) block_duration.rel_value); | 278 | "Stage %u: Initial suggestion took about %s\n", |
279 | stage, | ||
280 | GNUNET_STRINGS_relative_time_to_string (block_duration, | ||
281 | GNUNET_YES)); | ||
264 | 282 | ||
265 | block_start = GNUNET_TIME_absolute_get(); | 283 | block_start = GNUNET_TIME_absolute_get(); |
266 | wait_task = GNUNET_SCHEDULER_add_delayed (WAIT, &request_task, NULL); | 284 | wait_task = GNUNET_SCHEDULER_add_delayed (WAIT, &request_task, NULL); |
@@ -270,22 +288,28 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
270 | /* Startup suggestion */ | 288 | /* Startup suggestion */ |
271 | if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) | 289 | if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) |
272 | { | 290 | { |
273 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stage %u: Callback with correct address `%s'\n", stage, | 291 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
292 | "Stage %u: Callback with correct address `%s'\n", | ||
293 | stage, | ||
274 | GNUNET_i2s (&address->peer)); | 294 | GNUNET_i2s (&address->peer)); |
275 | ret = 0; | 295 | ret = 0; |
276 | } | 296 | } |
277 | else | 297 | else |
278 | { | 298 | { |
279 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stage %u: Callback with invalid address `%s'\n", stage, | 299 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
300 | "Stage %u: Callback with invalid address `%s'\n", | ||
301 | stage, | ||
280 | GNUNET_i2s (&address->peer)); | 302 | GNUNET_i2s (&address->peer)); |
281 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 303 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
282 | GNUNET_SCHEDULER_add_now (&end, NULL); | 304 | GNUNET_SCHEDULER_add_now (&end, NULL); |
283 | ret = 1; | 305 | ret = 1; |
284 | } | 306 | } |
285 | 307 | ||
286 | if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) | 308 | if (GNUNET_OK != compare_ats (atsi, ats_count, test_ats_info, test_ats_count)) |
287 | { | 309 | { |
288 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: Callback with incorrect ats info \n"); | 310 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
311 | "Stage %u: Callback with incorrect ats info\n", | ||
312 | stage); | ||
289 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 313 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
290 | GNUNET_SCHEDULER_add_now (&end, NULL); | 314 | GNUNET_SCHEDULER_add_now (&end, NULL); |
291 | ret = 1; | 315 | ret = 1; |
@@ -312,7 +336,8 @@ run (void *cls, | |||
312 | sched_ats = GNUNET_ATS_scheduling_init (cfg, &address_suggest_cb, NULL); | 336 | sched_ats = GNUNET_ATS_scheduling_init (cfg, &address_suggest_cb, NULL); |
313 | if (sched_ats == NULL) | 337 | if (sched_ats == NULL) |
314 | { | 338 | { |
315 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not connect to ATS scheduling!\n"); | 339 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
340 | "Could not connect to ATS scheduling!\n"); | ||
316 | ret = 1; | 341 | ret = 1; |
317 | end (); | 342 | end (); |
318 | return; | 343 | return; |
@@ -321,14 +346,16 @@ run (void *cls, | |||
321 | /* Set up peer */ | 346 | /* Set up peer */ |
322 | if (GNUNET_SYSERR == GNUNET_CRYPTO_hash_from_string(PEERID0, &p.id.hashPubKey)) | 347 | if (GNUNET_SYSERR == GNUNET_CRYPTO_hash_from_string(PEERID0, &p.id.hashPubKey)) |
323 | { | 348 | { |
324 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not setup peer!\n"); | 349 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
350 | "Could not setup peer!\n"); | ||
325 | ret = GNUNET_SYSERR; | 351 | ret = GNUNET_SYSERR; |
326 | end (); | 352 | end (); |
327 | return; | 353 | return; |
328 | } | 354 | } |
329 | GNUNET_assert (0 == strcmp (PEERID0, GNUNET_i2s_full (&p.id))); | 355 | GNUNET_assert (0 == strcmp (PEERID0, GNUNET_i2s_full (&p.id))); |
330 | 356 | ||
331 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created peer `%s'\n", | 357 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
358 | "Created peer `%s'\n", | ||
332 | GNUNET_i2s_full(&p.id)); | 359 | GNUNET_i2s_full(&p.id)); |
333 | 360 | ||
334 | /* Prepare ATS Information */ | 361 | /* Prepare ATS Information */ |
diff --git a/src/ats/test_ats_api_scheduling_init.c b/src/ats/test_ats_api_scheduling_init.c index bd96a4df7..6d6505100 100644 --- a/src/ats/test_ats_api_scheduling_init.c +++ b/src/ats/test_ats_api_scheduling_init.c | |||
@@ -123,7 +123,9 @@ run (void *cls, | |||
123 | end_badly_now (); | 123 | end_badly_now (); |
124 | return; | 124 | return; |
125 | } | 125 | } |
126 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Waiting for %llu sec\n", (long long unsigned int) DELAY.rel_value); | 126 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Waiting for %s\n", |
127 | GNUNET_STRINGS_relative_time_to_string (DELAY, | ||
128 | GNUNET_YES)); | ||
127 | wait_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &delay, NULL); | 129 | wait_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &delay, NULL); |
128 | } | 130 | } |
129 | 131 | ||
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index d574d3762..879939b18 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c | |||
@@ -756,7 +756,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, | |||
756 | if ( ( (KX_STATE_KEY_RECEIVED == kx->status) || | 756 | if ( ( (KX_STATE_KEY_RECEIVED == kx->status) || |
757 | (KX_STATE_UP == kx->status) || | 757 | (KX_STATE_UP == kx->status) || |
758 | (KX_STATE_REKEY_SENT == kx->status) ) && | 758 | (KX_STATE_REKEY_SENT == kx->status) ) && |
759 | (end_t.abs_value <= kx->foreign_key_expires.abs_value) ) | 759 | (end_t.abs_value_us <= kx->foreign_key_expires.abs_value_us) ) |
760 | { | 760 | { |
761 | GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# old ephemeral keys ignored"), | 761 | GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# old ephemeral keys ignored"), |
762 | 1, GNUNET_NO); | 762 | 1, GNUNET_NO); |
@@ -796,15 +796,15 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, | |||
796 | return; | 796 | return; |
797 | } | 797 | } |
798 | now = GNUNET_TIME_absolute_get (); | 798 | now = GNUNET_TIME_absolute_get (); |
799 | if ( (end_t.abs_value < GNUNET_TIME_absolute_subtract (now, REKEY_TOLERANCE).abs_value) || | 799 | if ( (end_t.abs_value_us < GNUNET_TIME_absolute_subtract (now, REKEY_TOLERANCE).abs_value_us) || |
800 | (start_t.abs_value > GNUNET_TIME_absolute_add (now, REKEY_TOLERANCE).abs_value) ) | 800 | (start_t.abs_value_us > GNUNET_TIME_absolute_add (now, REKEY_TOLERANCE).abs_value_us) ) |
801 | { | 801 | { |
802 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 802 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
803 | _("Ephemeral key message from peer `%s' rejected as its validity range does not match our system time (%llu not in [%llu,%llu]).\n"), | 803 | _("Ephemeral key message from peer `%s' rejected as its validity range does not match our system time (%llu not in [%llu,%llu]).\n"), |
804 | GNUNET_i2s (&kx->peer), | 804 | GNUNET_i2s (&kx->peer), |
805 | now.abs_value, | 805 | now.abs_value_us, |
806 | start_t.abs_value, | 806 | start_t.abs_value_us, |
807 | end_t.abs_value); | 807 | end_t.abs_value_us); |
808 | return; | 808 | return; |
809 | } | 809 | } |
810 | if (GNUNET_OK != | 810 | if (GNUNET_OK != |
@@ -994,7 +994,7 @@ send_keep_alive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
994 | 994 | ||
995 | kx->keep_alive_task = GNUNET_SCHEDULER_NO_TASK; | 995 | kx->keep_alive_task = GNUNET_SCHEDULER_NO_TASK; |
996 | left = GNUNET_TIME_absolute_get_remaining (kx->timeout); | 996 | left = GNUNET_TIME_absolute_get_remaining (kx->timeout); |
997 | if (0 == left.rel_value) | 997 | if (0 == left.rel_value_us) |
998 | { | 998 | { |
999 | GNUNET_STATISTICS_update (GSC_stats, | 999 | GNUNET_STATISTICS_update (GSC_stats, |
1000 | gettext_noop ("# sessions terminated by timeout"), | 1000 | gettext_noop ("# sessions terminated by timeout"), |
@@ -1300,7 +1300,7 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, | |||
1300 | 1, GNUNET_NO); | 1300 | 1, GNUNET_NO); |
1301 | return; | 1301 | return; |
1302 | } | 1302 | } |
1303 | if (0 == GNUNET_TIME_absolute_get_remaining (kx->foreign_key_expires).rel_value) | 1303 | if (0 == GNUNET_TIME_absolute_get_remaining (kx->foreign_key_expires).rel_value_us) |
1304 | { | 1304 | { |
1305 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1305 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1306 | _("Session to peer `%s' went down due to key expiration (should not happen)\n"), | 1306 | _("Session to peer `%s' went down due to key expiration (should not happen)\n"), |
@@ -1394,8 +1394,8 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, | |||
1394 | 1394 | ||
1395 | /* check timestamp */ | 1395 | /* check timestamp */ |
1396 | t = GNUNET_TIME_absolute_ntoh (pt->timestamp); | 1396 | t = GNUNET_TIME_absolute_ntoh (pt->timestamp); |
1397 | if (GNUNET_TIME_absolute_get_duration (t).rel_value > | 1397 | if (GNUNET_TIME_absolute_get_duration (t).rel_value_us > |
1398 | MAX_MESSAGE_AGE.rel_value) | 1398 | MAX_MESSAGE_AGE.rel_value_us) |
1399 | { | 1399 | { |
1400 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1400 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1401 | "Message received far too old (%s). Content ignored.\n", | 1401 | "Message received far too old (%s). Content ignored.\n", |
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c index bf27d5600..a77919bde 100644 --- a/src/core/gnunet-service-core_sessions.c +++ b/src/core/gnunet-service-core_sessions.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2009-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -240,8 +240,8 @@ transmit_typemap_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
240 | delay = TYPEMAP_FREQUENCY; | 240 | delay = TYPEMAP_FREQUENCY; |
241 | } | 241 | } |
242 | /* randomize a bit to avoid spont. sync */ | 242 | /* randomize a bit to avoid spont. sync */ |
243 | delay.rel_value += | 243 | delay.rel_value_us += |
244 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000); | 244 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000 * 1000); |
245 | session->typemap_task = | 245 | session->typemap_task = |
246 | GNUNET_SCHEDULER_add_delayed (delay, &transmit_typemap_task, session); | 246 | GNUNET_SCHEDULER_add_delayed (delay, &transmit_typemap_task, session); |
247 | GNUNET_STATISTICS_update (GSC_stats, | 247 | GNUNET_STATISTICS_update (GSC_stats, |
@@ -409,7 +409,7 @@ discard_expired_requests (struct Session *session) | |||
409 | { | 409 | { |
410 | pos = nxt; | 410 | pos = nxt; |
411 | nxt = pos->next; | 411 | nxt = pos->next; |
412 | if ((pos->deadline.abs_value < now.abs_value) && | 412 | if ((pos->deadline.abs_value_us < now.abs_value_us) && |
413 | (GNUNET_YES != pos->was_solicited)) | 413 | (GNUNET_YES != pos->was_solicited)) |
414 | { | 414 | { |
415 | GNUNET_STATISTICS_update (GSC_stats, | 415 | GNUNET_STATISTICS_update (GSC_stats, |
@@ -501,7 +501,7 @@ try_transmission (struct Session *session) | |||
501 | now = GNUNET_TIME_absolute_get (); | 501 | now = GNUNET_TIME_absolute_get (); |
502 | if ((msize == 0) || | 502 | if ((msize == 0) || |
503 | ((msize < GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE / 2) && | 503 | ((msize < GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE / 2) && |
504 | (min_deadline.abs_value > now.abs_value))) | 504 | (min_deadline.abs_value_us > now.abs_value_us))) |
505 | { | 505 | { |
506 | /* not enough ready yet, try to solicit more */ | 506 | /* not enough ready yet, try to solicit more */ |
507 | solicit_messages (session); | 507 | solicit_messages (session); |
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index 149a49225..29f39585e 100644 --- a/src/core/test_core_api_reliability.c +++ b/src/core/test_core_api_reliability.c | |||
@@ -127,10 +127,10 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
127 | p1.th = NULL; | 127 | p1.th = NULL; |
128 | GNUNET_TRANSPORT_disconnect (p2.th); | 128 | GNUNET_TRANSPORT_disconnect (p2.th); |
129 | p2.th = NULL; | 129 | p2.th = NULL; |
130 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; | 130 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; |
131 | FPRINTF (stderr, "\nThroughput was %llu kb/s\n", | 131 | FPRINTF (stderr, "\nThroughput was %llu kb/s\n", |
132 | total_bytes * 1000 / 1024 / delta); | 132 | total_bytes * 1000000LL / 1024 / delta); |
133 | GAUGER ("CORE", "Core throughput/s", total_bytes * 1000 / 1024 / delta, | 133 | GAUGER ("CORE", "Core throughput/s", total_bytes * 1000000LL / 1024 / delta, |
134 | "kb/s"); | 134 | "kb/s"); |
135 | ok = 0; | 135 | ok = 0; |
136 | } | 136 | } |
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index e09417642..9eb4d841f 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c | |||
@@ -231,10 +231,10 @@ measurement_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
231 | FPRINTF (stdout, "%s", "\n"); | 231 | FPRINTF (stdout, "%s", "\n"); |
232 | running = GNUNET_NO; | 232 | running = GNUNET_NO; |
233 | 233 | ||
234 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; | 234 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; |
235 | 235 | ||
236 | throughput_out = total_bytes_sent * 1000 / delta; /* convert to bytes/s */ | 236 | throughput_out = total_bytes_sent * 1000000LL / delta; /* convert to bytes/s */ |
237 | throughput_in = total_bytes_recv * 1000 / delta; /* convert to bytes/s */ | 237 | throughput_in = total_bytes_recv * 1000000LL / delta; /* convert to bytes/s */ |
238 | 238 | ||
239 | max_quota_in = GNUNET_MIN (current_quota_p1_in, current_quota_p2_in); | 239 | max_quota_in = GNUNET_MIN (current_quota_p1_in, current_quota_p2_in); |
240 | max_quota_out = GNUNET_MIN (current_quota_p1_out, current_quota_p2_out); | 240 | max_quota_out = GNUNET_MIN (current_quota_p1_out, current_quota_p2_out); |
diff --git a/src/datacache/perf_datacache.c b/src/datacache/perf_datacache.c index 84775a314..027999d22 100644 --- a/src/datacache/perf_datacache.c +++ b/src/datacache/perf_datacache.c | |||
@@ -96,7 +96,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
96 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES)); | 96 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), GNUNET_YES)); |
97 | GNUNET_snprintf (gstr, sizeof (gstr), "DATACACHE-%s", plugin_name); | 97 | GNUNET_snprintf (gstr, sizeof (gstr), "DATACACHE-%s", plugin_name); |
98 | GAUGER (gstr, "Time to PUT item in datacache", | 98 | GAUGER (gstr, "Time to PUT item in datacache", |
99 | GNUNET_TIME_absolute_get_duration (start).rel_value / ITERATIONS, | 99 | GNUNET_TIME_absolute_get_duration (start).rel_value_us / 1000LL / ITERATIONS, |
100 | "ms/item"); | 100 | "ms/item"); |
101 | start = GNUNET_TIME_absolute_get (); | 101 | start = GNUNET_TIME_absolute_get (); |
102 | memset (&k, 0, sizeof (struct GNUNET_HashCode)); | 102 | memset (&k, 0, sizeof (struct GNUNET_HashCode)); |
@@ -116,7 +116,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
116 | ITERATIONS - found); | 116 | ITERATIONS - found); |
117 | if (found > 0) | 117 | if (found > 0) |
118 | GAUGER (gstr, "Time to GET item from datacache", | 118 | GAUGER (gstr, "Time to GET item from datacache", |
119 | GNUNET_TIME_absolute_get_duration (start).rel_value / found, | 119 | GNUNET_TIME_absolute_get_duration (start).rel_value_us / 1000LL / found, |
120 | "ms/item"); | 120 | "ms/item"); |
121 | GNUNET_DATACACHE_destroy (h); | 121 | GNUNET_DATACACHE_destroy (h); |
122 | ASSERT (ok == 0); | 122 | ASSERT (ok == 0); |
diff --git a/src/datacache/plugin_datacache_heap.c b/src/datacache/plugin_datacache_heap.c index 41dd08974..aee6cd5b8 100644 --- a/src/datacache/plugin_datacache_heap.c +++ b/src/datacache/plugin_datacache_heap.c | |||
@@ -182,7 +182,7 @@ put_cb (void *cls, | |||
182 | put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity)); | 182 | put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity)); |
183 | GNUNET_CONTAINER_heap_update_cost (put_ctx->heap, | 183 | GNUNET_CONTAINER_heap_update_cost (put_ctx->heap, |
184 | val->hn, | 184 | val->hn, |
185 | val->discard_time.abs_value); | 185 | val->discard_time.abs_value_us); |
186 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 186 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
187 | "Got same value for key %s and type %d (size %u vs %u)\n", | 187 | "Got same value for key %s and type %d (size %u vs %u)\n", |
188 | GNUNET_h2s (key), | 188 | GNUNET_h2s (key), |
@@ -250,7 +250,7 @@ heap_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size, | |||
250 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 250 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
251 | val->hn = GNUNET_CONTAINER_heap_insert (plugin->heap, | 251 | val->hn = GNUNET_CONTAINER_heap_insert (plugin->heap, |
252 | val, | 252 | val, |
253 | val->discard_time.abs_value); | 253 | val->discard_time.abs_value_us); |
254 | return size + OVERHEAD; | 254 | return size + OVERHEAD; |
255 | } | 255 | } |
256 | 256 | ||
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c index e7d2e72c2..c8d66ead1 100644 --- a/src/datacache/plugin_datacache_postgres.c +++ b/src/datacache/plugin_datacache_postgres.c | |||
@@ -176,7 +176,7 @@ postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size, | |||
176 | struct Plugin *plugin = cls; | 176 | struct Plugin *plugin = cls; |
177 | PGresult *ret; | 177 | PGresult *ret; |
178 | uint32_t btype = htonl (type); | 178 | uint32_t btype = htonl (type); |
179 | uint64_t bexpi = GNUNET_TIME_absolute_hton (discard_time).abs_value__; | 179 | uint64_t bexpi = GNUNET_TIME_absolute_hton (discard_time).abs_value_us__; |
180 | 180 | ||
181 | const char *paramValues[] = { | 181 | const char *paramValues[] = { |
182 | (const char *) &btype, | 182 | (const char *) &btype, |
@@ -277,7 +277,7 @@ postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key, | |||
277 | } | 277 | } |
278 | for (i = 0; i < cnt; i++) | 278 | for (i = 0; i < cnt; i++) |
279 | { | 279 | { |
280 | expiration_time.abs_value = | 280 | expiration_time.abs_value_us = |
281 | GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, i, 0)); | 281 | GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, i, 0)); |
282 | type = ntohl (*(uint32_t *) PQgetvalue (res, i, 1)); | 282 | type = ntohl (*(uint32_t *) PQgetvalue (res, i, 1)); |
283 | size = PQgetlength (res, i, 2); | 283 | size = PQgetlength (res, i, 2); |
diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c index bf76f310f..34aa61363 100644 --- a/src/datacache/plugin_datacache_sqlite.c +++ b/src/datacache/plugin_datacache_sqlite.c | |||
@@ -116,7 +116,7 @@ sqlite_plugin_put (void *cls, | |||
116 | "Processing `%s' of %u bytes with key `%4s' and expiration %s\n", | 116 | "Processing `%s' of %u bytes with key `%4s' and expiration %s\n", |
117 | "PUT", (unsigned int) size, GNUNET_h2s (key), | 117 | "PUT", (unsigned int) size, GNUNET_h2s (key), |
118 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (discard_time), GNUNET_YES)); | 118 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (discard_time), GNUNET_YES)); |
119 | dval = (int64_t) discard_time.abs_value; | 119 | dval = (int64_t) discard_time.abs_value_us; |
120 | if (dval < 0) | 120 | if (dval < 0) |
121 | dval = INT64_MAX; | 121 | dval = INT64_MAX; |
122 | if (sq_prepare | 122 | if (sq_prepare |
@@ -203,13 +203,13 @@ sqlite_plugin_get (void *cls, const struct GNUNET_HashCode * key, | |||
203 | "sq_prepare"); | 203 | "sq_prepare"); |
204 | return 0; | 204 | return 0; |
205 | } | 205 | } |
206 | ntime = (int64_t) now.abs_value; | 206 | ntime = (int64_t) now.abs_value_us; |
207 | GNUNET_assert (ntime >= 0); | 207 | GNUNET_assert (ntime >= 0); |
208 | if ((SQLITE_OK != | 208 | if ((SQLITE_OK != |
209 | sqlite3_bind_blob (stmt, 1, key, sizeof (struct GNUNET_HashCode), | 209 | sqlite3_bind_blob (stmt, 1, key, sizeof (struct GNUNET_HashCode), |
210 | SQLITE_TRANSIENT)) || | 210 | SQLITE_TRANSIENT)) || |
211 | (SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) || | 211 | (SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) || |
212 | (SQLITE_OK != sqlite3_bind_int64 (stmt, 3, now.abs_value))) | 212 | (SQLITE_OK != sqlite3_bind_int64 (stmt, 3, now.abs_value_us))) |
213 | { | 213 | { |
214 | LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 214 | LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
215 | "sqlite3_bind_xxx"); | 215 | "sqlite3_bind_xxx"); |
@@ -256,7 +256,7 @@ sqlite_plugin_get (void *cls, const struct GNUNET_HashCode * key, | |||
256 | sqlite3_bind_blob (stmt, 1, key, sizeof (struct GNUNET_HashCode), | 256 | sqlite3_bind_blob (stmt, 1, key, sizeof (struct GNUNET_HashCode), |
257 | SQLITE_TRANSIENT)) || | 257 | SQLITE_TRANSIENT)) || |
258 | (SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) || | 258 | (SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) || |
259 | (SQLITE_OK != sqlite3_bind_int64 (stmt, 3, now.abs_value))) | 259 | (SQLITE_OK != sqlite3_bind_int64 (stmt, 3, now.abs_value_us))) |
260 | { | 260 | { |
261 | LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 261 | LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
262 | "sqlite3_bind_xxx"); | 262 | "sqlite3_bind_xxx"); |
@@ -267,7 +267,7 @@ sqlite_plugin_get (void *cls, const struct GNUNET_HashCode * key, | |||
267 | break; | 267 | break; |
268 | size = sqlite3_column_bytes (stmt, 0); | 268 | size = sqlite3_column_bytes (stmt, 0); |
269 | dat = sqlite3_column_blob (stmt, 0); | 269 | dat = sqlite3_column_blob (stmt, 0); |
270 | exp.abs_value = sqlite3_column_int64 (stmt, 1); | 270 | exp.abs_value_us = sqlite3_column_int64 (stmt, 1); |
271 | psize = sqlite3_column_bytes (stmt, 2); | 271 | psize = sqlite3_column_bytes (stmt, 2); |
272 | if (0 != psize % sizeof (struct GNUNET_PeerIdentity)) | 272 | if (0 != psize % sizeof (struct GNUNET_PeerIdentity)) |
273 | { | 273 | { |
@@ -279,7 +279,7 @@ sqlite_plugin_get (void *cls, const struct GNUNET_HashCode * key, | |||
279 | path = sqlite3_column_blob (stmt, 2); | 279 | path = sqlite3_column_blob (stmt, 2); |
280 | else | 280 | else |
281 | path = NULL; | 281 | path = NULL; |
282 | ntime = (int64_t) exp.abs_value; | 282 | ntime = (int64_t) exp.abs_value_us; |
283 | if (ntime == INT64_MAX) | 283 | if (ntime == INT64_MAX) |
284 | exp = GNUNET_TIME_UNIT_FOREVER_ABS; | 284 | exp = GNUNET_TIME_UNIT_FOREVER_ABS; |
285 | cnt++; | 285 | cnt++; |
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c index 8c429cc7a..071ae721f 100644 --- a/src/datacache/test_datacache.c +++ b/src/datacache/test_datacache.c | |||
@@ -80,7 +80,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
80 | return; | 80 | return; |
81 | } | 81 | } |
82 | exp = GNUNET_TIME_absolute_get (); | 82 | exp = GNUNET_TIME_absolute_get (); |
83 | exp.abs_value += 5 * 60 * 1000; | 83 | exp.abs_value_us += 5 * 60 * 1000 * 1000LL; |
84 | memset (&k, 0, sizeof (struct GNUNET_HashCode)); | 84 | memset (&k, 0, sizeof (struct GNUNET_HashCode)); |
85 | for (i = 0; i < 100; i++) | 85 | for (i = 0; i < 100; i++) |
86 | { | 86 | { |
diff --git a/src/datacache/test_datacache_quota.c b/src/datacache/test_datacache_quota.c index 0400b5051..877c62a3f 100644 --- a/src/datacache/test_datacache_quota.c +++ b/src/datacache/test_datacache_quota.c | |||
@@ -71,7 +71,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
71 | GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n); | 71 | GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n); |
72 | for (j = i; j < sizeof (buf); j += 10) | 72 | for (j = i; j < sizeof (buf); j += 10) |
73 | { | 73 | { |
74 | exp.abs_value++; | 74 | exp.abs_value_us++; |
75 | buf[j] = i; | 75 | buf[j] = i; |
76 | ASSERT (GNUNET_OK == GNUNET_DATACACHE_put (h, &k, j, buf, 1 + i, exp, 0, NULL)); | 76 | ASSERT (GNUNET_OK == GNUNET_DATACACHE_put (h, &k, j, buf, 1 + i, exp, 0, NULL)); |
77 | ASSERT (0 < GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL)); | 77 | ASSERT (0 < GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL)); |
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index fab3bf0ca..2fb250b96 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c | |||
@@ -850,9 +850,10 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, uint32_t rid, | |||
850 | union QueueContext qc; | 850 | union QueueContext qc; |
851 | 851 | ||
852 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 852 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
853 | "Asked to put %u bytes of data under key `%s' for %llu ms\n", size, | 853 | "Asked to put %u bytes of data under key `%s' for %s\n", size, |
854 | GNUNET_h2s (key), | 854 | GNUNET_h2s (key), |
855 | GNUNET_TIME_absolute_get_remaining (expiration).rel_value); | 855 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration), |
856 | GNUNET_YES)); | ||
856 | msize = sizeof (struct DataMessage) + size; | 857 | msize = sizeof (struct DataMessage) + size; |
857 | GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE); | 858 | GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE); |
858 | qc.sc.cont = cont; | 859 | qc.sc.cont = cont; |
@@ -1037,8 +1038,10 @@ GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, uint64_t uid, | |||
1037 | if (cont == NULL) | 1038 | if (cont == NULL) |
1038 | cont = &drop_status_cont; | 1039 | cont = &drop_status_cont; |
1039 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1040 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1040 | "Asked to update entry %llu raising priority by %u and expiration to %llu\n", | 1041 | "Asked to update entry %llu raising priority by %u and expiration to %s\n", |
1041 | uid, (unsigned int) priority, (unsigned long long) expiration.abs_value); | 1042 | uid, |
1043 | (unsigned int) priority, | ||
1044 | GNUNET_STRINGS_absolute_time_to_string (expiration)); | ||
1042 | qc.sc.cont = cont; | 1045 | qc.sc.cont = cont; |
1043 | qc.sc.cont_cls = cont_cls; | 1046 | qc.sc.cont_cls = cont_cls; |
1044 | qe = make_queue_entry (h, sizeof (struct UpdateMessage), queue_priority, | 1047 | qe = make_queue_entry (h, sizeof (struct UpdateMessage), queue_priority, |
@@ -1268,8 +1271,9 @@ GNUNET_DATASTORE_get_for_replication (struct GNUNET_DATASTORE_Handle *h, | |||
1268 | union QueueContext qc; | 1271 | union QueueContext qc; |
1269 | 1272 | ||
1270 | GNUNET_assert (NULL != proc); | 1273 | GNUNET_assert (NULL != proc); |
1271 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to get replication entry in %llu ms\n", | 1274 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1272 | (unsigned long long) timeout.rel_value); | 1275 | "Asked to get replication entry in %s\n", |
1276 | GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_YES)); | ||
1273 | qc.rc.proc = proc; | 1277 | qc.rc.proc = proc; |
1274 | qc.rc.proc_cls = proc_cls; | 1278 | qc.rc.proc_cls = proc_cls; |
1275 | qe = make_queue_entry (h, sizeof (struct GNUNET_MessageHeader), | 1279 | qe = make_queue_entry (h, sizeof (struct GNUNET_MessageHeader), |
@@ -1330,9 +1334,9 @@ GNUNET_DATASTORE_get_zero_anonymity (struct GNUNET_DATASTORE_Handle *h, | |||
1330 | GNUNET_assert (NULL != proc); | 1334 | GNUNET_assert (NULL != proc); |
1331 | GNUNET_assert (type != GNUNET_BLOCK_TYPE_ANY); | 1335 | GNUNET_assert (type != GNUNET_BLOCK_TYPE_ANY); |
1332 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1336 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1333 | "Asked to get %llu-th zero-anonymity entry of type %d in %llu ms\n", | 1337 | "Asked to get %llu-th zero-anonymity entry of type %d in %s\n", |
1334 | (unsigned long long) offset, type, | 1338 | (unsigned long long) offset, type, |
1335 | (unsigned long long) timeout.rel_value); | 1339 | GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_YES)); |
1336 | qc.rc.proc = proc; | 1340 | qc.rc.proc = proc; |
1337 | qc.rc.proc_cls = proc_cls; | 1341 | qc.rc.proc_cls = proc_cls; |
1338 | qe = make_queue_entry (h, sizeof (struct GetZeroAnonymityMessage), | 1342 | qe = make_queue_entry (h, sizeof (struct GetZeroAnonymityMessage), |
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index 93b43b16c..f6018b7b5 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c | |||
@@ -332,7 +332,7 @@ expired_processor (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
332 | return GNUNET_SYSERR; | 332 | return GNUNET_SYSERR; |
333 | } | 333 | } |
334 | now = GNUNET_TIME_absolute_get (); | 334 | now = GNUNET_TIME_absolute_get (); |
335 | if (expiration.abs_value > now.abs_value) | 335 | if (expiration.abs_value_us > now.abs_value_us) |
336 | { | 336 | { |
337 | /* finished processing */ | 337 | /* finished processing */ |
338 | expired_kill_task = | 338 | expired_kill_task = |
@@ -342,9 +342,11 @@ expired_processor (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
342 | return GNUNET_SYSERR; | 342 | return GNUNET_SYSERR; |
343 | } | 343 | } |
344 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 344 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
345 | "Deleting content `%s' of type %u that expired %llu ms ago\n", | 345 | "Deleting content `%s' of type %u that expired %s ago\n", |
346 | GNUNET_h2s (key), type, | 346 | GNUNET_h2s (key), type, |
347 | (unsigned long long) (now.abs_value - expiration.abs_value)); | 347 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (expiration, |
348 | now), | ||
349 | GNUNET_YES)); | ||
348 | min_expiration = now; | 350 | min_expiration = now; |
349 | GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes expired"), size, | 351 | GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes expired"), size, |
350 | GNUNET_YES); | 352 | GNUNET_YES); |
@@ -404,11 +406,12 @@ quota_processor (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
404 | if (NULL == key) | 406 | if (NULL == key) |
405 | return GNUNET_SYSERR; | 407 | return GNUNET_SYSERR; |
406 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 408 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
407 | "Deleting %llu bytes of low-priority (%u) content `%s' of type %u at %llu ms prior to expiration (still trying to free another %llu bytes)\n", | 409 | "Deleting %llu bytes of low-priority (%u) content `%s' of type %u at %s prior to expiration (still trying to free another %llu bytes)\n", |
408 | (unsigned long long) (size + GNUNET_DATASTORE_ENTRY_OVERHEAD), | 410 | (unsigned long long) (size + GNUNET_DATASTORE_ENTRY_OVERHEAD), |
409 | (unsigned int) priority, | 411 | (unsigned int) priority, |
410 | GNUNET_h2s (key), type, | 412 | GNUNET_h2s (key), type, |
411 | (unsigned long long) GNUNET_TIME_absolute_get_remaining (expiration).rel_value, | 413 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration), |
414 | GNUNET_YES), | ||
412 | *need); | 415 | *need); |
413 | if (size + GNUNET_DATASTORE_ENTRY_OVERHEAD > *need) | 416 | if (size + GNUNET_DATASTORE_ENTRY_OVERHEAD > *need) |
414 | *need = 0; | 417 | *need = 0; |
@@ -619,10 +622,11 @@ transmit_item (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
619 | dm->key = *key; | 622 | dm->key = *key; |
620 | memcpy (&dm[1], data, size); | 623 | memcpy (&dm[1], data, size); |
621 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 624 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
622 | "Transmitting `%s' message for `%s' of type %u with expiration %llu (now: %llu)\n", | 625 | "Transmitting `%s' message for `%s' of type %u with expiration %s (in: %s)\n", |
623 | "DATA", GNUNET_h2s (key), type, | 626 | "DATA", GNUNET_h2s (key), type, |
624 | (unsigned long long) expiration.abs_value, | 627 | GNUNET_STRINGS_absolute_time_to_string (expiration), |
625 | (unsigned long long) GNUNET_TIME_absolute_get ().abs_value); | 628 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration), |
629 | GNUNET_YES)); | ||
626 | GNUNET_STATISTICS_update (stats, gettext_noop ("# results found"), 1, | 630 | GNUNET_STATISTICS_update (stats, gettext_noop ("# results found"), 1, |
627 | GNUNET_NO); | 631 | GNUNET_NO); |
628 | transmit (client, &dm->header); | 632 | transmit (client, &dm->header); |
@@ -896,8 +900,8 @@ check_present (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
896 | "Result already present in datastore\n"); | 900 | "Result already present in datastore\n"); |
897 | /* FIXME: change API to allow increasing 'replication' counter */ | 901 | /* FIXME: change API to allow increasing 'replication' counter */ |
898 | if ((ntohl (dm->priority) > 0) || | 902 | if ((ntohl (dm->priority) > 0) || |
899 | (GNUNET_TIME_absolute_ntoh (dm->expiration).abs_value > | 903 | (GNUNET_TIME_absolute_ntoh (dm->expiration).abs_value_us > |
900 | expiration.abs_value)) | 904 | expiration.abs_value_us)) |
901 | plugin->api->update (plugin->api->cls, uid, | 905 | plugin->api->update (plugin->api->cls, uid, |
902 | (int32_t) ntohl (dm->priority), | 906 | (int32_t) ntohl (dm->priority), |
903 | GNUNET_TIME_absolute_ntoh (dm->expiration), NULL); | 907 | GNUNET_TIME_absolute_ntoh (dm->expiration), NULL); |
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c index cf21ebe44..83be3ad5f 100644 --- a/src/datastore/perf_datastore_api.c +++ b/src/datastore/perf_datastore_api.c | |||
@@ -245,9 +245,9 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
245 | #endif | 245 | #endif |
246 | "Stored %llu kB / %lluk ops / %llu ops/s\n", stored_bytes / 1024, /* used size in k */ | 246 | "Stored %llu kB / %lluk ops / %llu ops/s\n", stored_bytes / 1024, /* used size in k */ |
247 | stored_ops / 1024, /* total operations (in k) */ | 247 | stored_ops / 1024, /* total operations (in k) */ |
248 | 1000 * stored_ops / (1 + | 248 | 1000LL * 1000LL * stored_ops / (1 + |
249 | GNUNET_TIME_absolute_get_duration | 249 | GNUNET_TIME_absolute_get_duration |
250 | (start_time).rel_value)); | 250 | (start_time).rel_value_us)); |
251 | crc->phase = RP_PUT; | 251 | crc->phase = RP_PUT; |
252 | crc->j = 0; | 252 | crc->j = 0; |
253 | GNUNET_SCHEDULER_add_continuation (&run_continuation, crc, | 253 | GNUNET_SCHEDULER_add_continuation (&run_continuation, crc, |
@@ -257,7 +257,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
257 | GNUNET_snprintf (gstr, sizeof (gstr), "DATASTORE-%s", plugin_name); | 257 | GNUNET_snprintf (gstr, sizeof (gstr), "DATASTORE-%s", plugin_name); |
258 | if ((crc->i == ITERATIONS) && (stored_ops > 0)) | 258 | if ((crc->i == ITERATIONS) && (stored_ops > 0)) |
259 | GAUGER (gstr, "PUT operation duration", | 259 | GAUGER (gstr, "PUT operation duration", |
260 | GNUNET_TIME_absolute_get_duration (start_time).rel_value / | 260 | GNUNET_TIME_absolute_get_duration (start_time).rel_value_us / 1000LL / |
261 | stored_ops, "ms/operation"); | 261 | stored_ops, "ms/operation"); |
262 | GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES); | 262 | GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES); |
263 | GNUNET_free (crc); | 263 | GNUNET_free (crc); |
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c index 322ca26b2..657acc66b 100644 --- a/src/datastore/perf_plugin_datastore.c +++ b/src/datastore/perf_plugin_datastore.c | |||
@@ -115,7 +115,7 @@ putValue (struct GNUNET_DATASTORE_PluginFunctions *api, int i, int k) | |||
115 | size = size - (size & 7); /* always multiple of 8 */ | 115 | size = size - (size & 7); /* always multiple of 8 */ |
116 | 116 | ||
117 | /* generate random key */ | 117 | /* generate random key */ |
118 | key.bits[0] = (unsigned int) GNUNET_TIME_absolute_get ().abs_value; | 118 | key.bits[0] = (unsigned int) GNUNET_TIME_absolute_get ().abs_value_us; |
119 | GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &key); | 119 | GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &key); |
120 | memset (value, i, size); | 120 | memset (value, i, size); |
121 | if (i > 255) | 121 | if (i > 255) |
@@ -164,9 +164,10 @@ iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
164 | hits[i / 8] |= (1 << (i % 8)); | 164 | hits[i / 8] |= (1 << (i % 8)); |
165 | 165 | ||
166 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 166 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
167 | "Found result %d type=%u, priority=%u, size=%u, expire=%llu\n", | 167 | "Found result %d type=%u, priority=%u, size=%u, expire=%s\n", |
168 | i, | 168 | i, |
169 | type, priority, size, (unsigned long long) expiration.abs_value); | 169 | type, priority, size, |
170 | GNUNET_STRINGS_absolute_time_to_string (expiration)); | ||
170 | crc->cnt++; | 171 | crc->cnt++; |
171 | if (crc->cnt == PUT_10 / 4 - 1) | 172 | if (crc->cnt == PUT_10 / 4 - 1) |
172 | { | 173 | { |
@@ -178,13 +179,15 @@ iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
178 | bc++; | 179 | bc++; |
179 | 180 | ||
180 | crc->end = GNUNET_TIME_absolute_get (); | 181 | crc->end = GNUNET_TIME_absolute_get (); |
181 | printf ("%s took %llu ms yielding %u/%u items\n", | 182 | printf ("%s took %s yielding %u/%u items\n", |
182 | "Select random zero-anonymity item", | 183 | "Select random zero-anonymity item", |
183 | (unsigned long long) (crc->end.abs_value - crc->start.abs_value), | 184 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (crc->start, |
185 | crc->end), | ||
186 | GNUNET_YES), | ||
184 | bc, crc->cnt); | 187 | bc, crc->cnt); |
185 | if (crc->cnt > 0) | 188 | if (crc->cnt > 0) |
186 | GAUGER (category, "Select random zero-anonymity item", | 189 | GAUGER (category, "Select random zero-anonymity item", |
187 | (crc->end.abs_value - crc->start.abs_value) / crc->cnt, | 190 | (crc->end.abs_value_us - crc->start.abs_value_us) / 1000LL / crc->cnt, |
188 | "ms/item"); | 191 | "ms/item"); |
189 | memset (hits, 0, sizeof (hits)); | 192 | memset (hits, 0, sizeof (hits)); |
190 | crc->phase++; | 193 | crc->phase++; |
@@ -220,13 +223,15 @@ expiration_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
220 | bc++; | 223 | bc++; |
221 | 224 | ||
222 | crc->end = GNUNET_TIME_absolute_get (); | 225 | crc->end = GNUNET_TIME_absolute_get (); |
223 | printf ("%s took %llu ms yielding %u/%u items\n", | 226 | printf ("%s took %s yielding %u/%u items\n", |
224 | "Selecting and deleting by expiration", | 227 | "Selecting and deleting by expiration", |
225 | (unsigned long long) (crc->end.abs_value - crc->start.abs_value), | 228 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (crc->start, |
229 | crc->end), | ||
230 | GNUNET_YES), | ||
226 | bc, (unsigned int) PUT_10); | 231 | bc, (unsigned int) PUT_10); |
227 | if (crc->cnt > 0) | 232 | if (crc->cnt > 0) |
228 | GAUGER (category, "Selecting and deleting by expiration", | 233 | GAUGER (category, "Selecting and deleting by expiration", |
229 | (crc->end.abs_value - crc->start.abs_value) / crc->cnt, | 234 | (crc->end.abs_value_us - crc->start.abs_value_us) / 1000LL / crc->cnt, |
230 | "ms/item"); | 235 | "ms/item"); |
231 | memset (hits, 0, sizeof (hits)); | 236 | memset (hits, 0, sizeof (hits)); |
232 | if (++crc->iter == ITERATIONS) | 237 | if (++crc->iter == ITERATIONS) |
@@ -266,13 +271,15 @@ replication_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
266 | bc++; | 271 | bc++; |
267 | 272 | ||
268 | crc->end = GNUNET_TIME_absolute_get (); | 273 | crc->end = GNUNET_TIME_absolute_get (); |
269 | printf ("%s took %llu ms yielding %u/%u items\n", | 274 | printf ("%s took %s yielding %u/%u items\n", |
270 | "Selecting random item for replication", | 275 | "Selecting random item for replication", |
271 | (unsigned long long) (crc->end.abs_value - crc->start.abs_value), | 276 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (crc->start, |
277 | crc->end), | ||
278 | GNUNET_YES), | ||
272 | bc, (unsigned int) PUT_10); | 279 | bc, (unsigned int) PUT_10); |
273 | if (crc->cnt > 0) | 280 | if (crc->cnt > 0) |
274 | GAUGER (category, "Selecting random item for replication", | 281 | GAUGER (category, "Selecting random item for replication", |
275 | (crc->end.abs_value - crc->start.abs_value) / crc->cnt, | 282 | (crc->end.abs_value_us - crc->start.abs_value_us) / 1000LL / crc->cnt, |
276 | "ms/item"); | 283 | "ms/item"); |
277 | memset (hits, 0, sizeof (hits)); | 284 | memset (hits, 0, sizeof (hits)); |
278 | crc->phase++; | 285 | crc->phase++; |
@@ -359,12 +366,14 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
359 | putValue (crc->api, j, crc->i); | 366 | putValue (crc->api, j, crc->i); |
360 | crc->end = GNUNET_TIME_absolute_get (); | 367 | crc->end = GNUNET_TIME_absolute_get (); |
361 | { | 368 | { |
362 | printf ("%s took %llu ms for %llu items\n", "Storing an item", | 369 | printf ("%s took %s for %llu items\n", "Storing an item", |
363 | (unsigned long long) (crc->end.abs_value - crc->start.abs_value), | 370 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (crc->start, |
371 | crc->end), | ||
372 | GNUNET_YES), | ||
364 | PUT_10); | 373 | PUT_10); |
365 | if (PUT_10 > 0) | 374 | if (PUT_10 > 0) |
366 | GAUGER (category, "Storing an item", | 375 | GAUGER (category, "Storing an item", |
367 | (crc->end.abs_value - crc->start.abs_value) / PUT_10, | 376 | (crc->end.abs_value_us - crc->start.abs_value_us) / 1000LL / PUT_10, |
368 | "ms/item"); | 377 | "ms/item"); |
369 | } | 378 | } |
370 | crc->i++; | 379 | crc->i++; |
diff --git a/src/datastore/plugin_datastore_heap.c b/src/datastore/plugin_datastore_heap.c index 9f9360bfb..79dcb9043 100644 --- a/src/datastore/plugin_datastore_heap.c +++ b/src/datastore/plugin_datastore_heap.c | |||
@@ -226,7 +226,7 @@ heap_plugin_put (void *cls, | |||
226 | value->data = &value[1]; | 226 | value->data = &value[1]; |
227 | value->expire_heap = GNUNET_CONTAINER_heap_insert (plugin->by_expiration, | 227 | value->expire_heap = GNUNET_CONTAINER_heap_insert (plugin->by_expiration, |
228 | value, | 228 | value, |
229 | expiration.abs_value); | 229 | expiration.abs_value_us); |
230 | value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication, | 230 | value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication, |
231 | value, | 231 | value, |
232 | replication); | 232 | replication); |
@@ -628,12 +628,12 @@ heap_plugin_update (void *cls, | |||
628 | 628 | ||
629 | value = (struct Value*) (long) uid; | 629 | value = (struct Value*) (long) uid; |
630 | GNUNET_assert (NULL != value); | 630 | GNUNET_assert (NULL != value); |
631 | if (value->expiration.abs_value != expire.abs_value) | 631 | if (value->expiration.abs_value_us != expire.abs_value_us) |
632 | { | 632 | { |
633 | value->expiration = expire; | 633 | value->expiration = expire; |
634 | GNUNET_CONTAINER_heap_update_cost (plugin->by_expiration, | 634 | GNUNET_CONTAINER_heap_update_cost (plugin->by_expiration, |
635 | value->expire_heap, | 635 | value->expire_heap, |
636 | expire.abs_value); | 636 | expire.abs_value_us); |
637 | } | 637 | } |
638 | if ( (delta < 0) && (value->priority < - delta) ) | 638 | if ( (delta < 0) && (value->priority < - delta) ) |
639 | value->priority = 0; | 639 | value->priority = 0; |
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index ad70e73d4..40f25deee 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c | |||
@@ -290,7 +290,7 @@ mysql_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
290 | unsigned int irepl = replication; | 290 | unsigned int irepl = replication; |
291 | unsigned int ipriority = priority; | 291 | unsigned int ipriority = priority; |
292 | unsigned int ianonymity = anonymity; | 292 | unsigned int ianonymity = anonymity; |
293 | unsigned long long lexpiration = expiration.abs_value; | 293 | unsigned long long lexpiration = expiration.abs_value_us; |
294 | unsigned long long lrvalue = | 294 | unsigned long long lrvalue = |
295 | (unsigned long long) GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | 295 | (unsigned long long) GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, |
296 | UINT64_MAX); | 296 | UINT64_MAX); |
@@ -358,12 +358,13 @@ mysql_plugin_update (void *cls, uint64_t uid, int delta, | |||
358 | { | 358 | { |
359 | struct Plugin *plugin = cls; | 359 | struct Plugin *plugin = cls; |
360 | unsigned long long vkey = uid; | 360 | unsigned long long vkey = uid; |
361 | unsigned long long lexpire = expire.abs_value; | 361 | unsigned long long lexpire = expire.abs_value_us; |
362 | int ret; | 362 | int ret; |
363 | 363 | ||
364 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 364 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
365 | "Updating value %llu adding %d to priority and maxing exp at %llu\n", | 365 | "Updating value %llu adding %d to priority and maxing exp at %s\n", |
366 | vkey, delta, lexpire); | 366 | vkey, delta, |
367 | GNUNET_STRINGS_absolute_time_to_string (expire)); | ||
367 | ret = | 368 | ret = |
368 | GNUNET_MYSQL_statement_run_prepared (plugin->mc, plugin->update_entry, NULL, | 369 | GNUNET_MYSQL_statement_run_prepared (plugin->mc, plugin->update_entry, NULL, |
369 | MYSQL_TYPE_LONG, &delta, GNUNET_NO, | 370 | MYSQL_TYPE_LONG, &delta, GNUNET_NO, |
@@ -449,11 +450,13 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt | |||
449 | proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); | 450 | proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); |
450 | return; | 451 | return; |
451 | } | 452 | } |
453 | expiration.abs_value_us = exp; | ||
452 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 454 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
453 | "Found %u-byte value under key `%s' with prio %u, anon %u, expire %llu selecting from gn090 table\n", | 455 | "Found %u-byte value under key `%s' with prio %u, anon %u, expire %s selecting from gn090 table\n", |
454 | (unsigned int) size, GNUNET_h2s (&key), priority, anonymity, exp); | 456 | (unsigned int) size, GNUNET_h2s (&key), |
457 | priority, anonymity, | ||
458 | GNUNET_STRINGS_absolute_time_to_string (expiration)); | ||
455 | GNUNET_assert (size < MAX_DATUM_SIZE); | 459 | GNUNET_assert (size < MAX_DATUM_SIZE); |
456 | expiration.abs_value = exp; | ||
457 | ret = | 460 | ret = |
458 | proc (proc_cls, &key, size, value, type, priority, anonymity, expiration, | 461 | proc (proc_cls, &key, size, value, type, priority, anonymity, expiration, |
459 | uid); | 462 | uid); |
@@ -907,7 +910,7 @@ mysql_plugin_get_expiration (void *cls, PluginDatumProcessor proc, | |||
907 | rc.plugin = plugin; | 910 | rc.plugin = plugin; |
908 | rc.proc = proc; | 911 | rc.proc = proc; |
909 | rc.proc_cls = proc_cls; | 912 | rc.proc_cls = proc_cls; |
910 | nt = (long long) GNUNET_TIME_absolute_get ().abs_value; | 913 | nt = (long long) GNUNET_TIME_absolute_get ().abs_value_us; |
911 | execute_select (plugin, plugin->select_expiration, expi_proc, &rc, | 914 | execute_select (plugin, plugin->select_expiration, expi_proc, &rc, |
912 | MYSQL_TYPE_LONGLONG, &nt, GNUNET_YES, -1); | 915 | MYSQL_TYPE_LONGLONG, &nt, GNUNET_YES, -1); |
913 | 916 | ||
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index 83fc423da..98109d4da 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2009, 2010, 2011, 2012 Christian Grothoff (and other contributing authors) | 3 | (C) 2009-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -283,7 +283,7 @@ postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t siz | |||
283 | uint32_t bprio = htonl (priority); | 283 | uint32_t bprio = htonl (priority); |
284 | uint32_t banon = htonl (anonymity); | 284 | uint32_t banon = htonl (anonymity); |
285 | uint32_t brepl = htonl (replication); | 285 | uint32_t brepl = htonl (replication); |
286 | uint64_t bexpi = GNUNET_TIME_absolute_hton (expiration).abs_value__; | 286 | uint64_t bexpi = GNUNET_TIME_absolute_hton (expiration).abs_value_us__; |
287 | 287 | ||
288 | const char *paramValues[] = { | 288 | const char *paramValues[] = { |
289 | (const char *) &brepl, | 289 | (const char *) &brepl, |
@@ -392,7 +392,7 @@ process_result (struct Plugin *plugin, PluginDatumProcessor proc, | |||
392 | type = ntohl (*(uint32_t *) PQgetvalue (res, 0, 0)); | 392 | type = ntohl (*(uint32_t *) PQgetvalue (res, 0, 0)); |
393 | priority = ntohl (*(uint32_t *) PQgetvalue (res, 0, 1)); | 393 | priority = ntohl (*(uint32_t *) PQgetvalue (res, 0, 1)); |
394 | anonymity = ntohl (*(uint32_t *) PQgetvalue (res, 0, 2)); | 394 | anonymity = ntohl (*(uint32_t *) PQgetvalue (res, 0, 2)); |
395 | expiration_time.abs_value = | 395 | expiration_time.abs_value_us = |
396 | GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0, 3)); | 396 | GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0, 3)); |
397 | memcpy (&key, PQgetvalue (res, 0, 4), sizeof (struct GNUNET_HashCode)); | 397 | memcpy (&key, PQgetvalue (res, 0, 4), sizeof (struct GNUNET_HashCode)); |
398 | size = PQgetlength (res, 0, 5); | 398 | size = PQgetlength (res, 0, 5); |
@@ -712,7 +712,7 @@ postgres_plugin_get_expiration (void *cls, PluginDatumProcessor proc, | |||
712 | const char *paramValues[] = { (const char *) &btime }; | 712 | const char *paramValues[] = { (const char *) &btime }; |
713 | PGresult *ret; | 713 | PGresult *ret; |
714 | 714 | ||
715 | btime = GNUNET_htonll (GNUNET_TIME_absolute_get ().abs_value); | 715 | btime = GNUNET_htonll (GNUNET_TIME_absolute_get ().abs_value_us); |
716 | ret = | 716 | ret = |
717 | PQexecPrepared (plugin->dbh, "select_expiration_order", 1, paramValues, | 717 | PQexecPrepared (plugin->dbh, "select_expiration_order", 1, paramValues, |
718 | paramLengths, paramFormats, 1); | 718 | paramLengths, paramFormats, 1); |
@@ -751,7 +751,7 @@ postgres_plugin_update (void *cls, uint64_t uid, int delta, | |||
751 | PGresult *ret; | 751 | PGresult *ret; |
752 | int32_t bdelta = (int32_t) htonl ((uint32_t) delta); | 752 | int32_t bdelta = (int32_t) htonl ((uint32_t) delta); |
753 | uint32_t boid = htonl ((uint32_t) uid); | 753 | uint32_t boid = htonl ((uint32_t) uid); |
754 | uint64_t bexpire = GNUNET_TIME_absolute_hton (expire).abs_value__; | 754 | uint64_t bexpire = GNUNET_TIME_absolute_hton (expire).abs_value_us__; |
755 | 755 | ||
756 | const char *paramValues[] = { | 756 | const char *paramValues[] = { |
757 | (const char *) &bdelta, | 757 | (const char *) &bdelta, |
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index e77e8b9fa..9a4b40255 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c | |||
@@ -488,11 +488,12 @@ sqlite_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
488 | if (size > MAX_ITEM_SIZE) | 488 | if (size > MAX_ITEM_SIZE) |
489 | return GNUNET_SYSERR; | 489 | return GNUNET_SYSERR; |
490 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", | 490 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", |
491 | "Storing in database block with type %u/key `%s'/priority %u/expiration in %llu ms (%lld).\n", | 491 | "Storing in database block with type %u/key `%s'/priority %u/expiration in %s (%s).\n", |
492 | type, GNUNET_h2s (key), priority, | 492 | type, GNUNET_h2s (key), priority, |
493 | (unsigned long long) | 493 | (unsigned long long) |
494 | GNUNET_TIME_absolute_get_remaining (expiration).rel_value, | 494 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration), |
495 | (long long) expiration.abs_value); | 495 | GNUNET_YES), |
496 | GNUNET_STRINGS_absolute_time_to_string (expiration)); | ||
496 | GNUNET_CRYPTO_hash (data, size, &vhash); | 497 | GNUNET_CRYPTO_hash (data, size, &vhash); |
497 | stmt = plugin->insertContent; | 498 | stmt = plugin->insertContent; |
498 | rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); | 499 | rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); |
@@ -500,7 +501,7 @@ sqlite_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
500 | (SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) || | 501 | (SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) || |
501 | (SQLITE_OK != sqlite3_bind_int (stmt, 3, priority)) || | 502 | (SQLITE_OK != sqlite3_bind_int (stmt, 3, priority)) || |
502 | (SQLITE_OK != sqlite3_bind_int (stmt, 4, anonymity)) || | 503 | (SQLITE_OK != sqlite3_bind_int (stmt, 4, anonymity)) || |
503 | (SQLITE_OK != sqlite3_bind_int64 (stmt, 5, expiration.abs_value)) || | 504 | (SQLITE_OK != sqlite3_bind_int64 (stmt, 5, expiration.abs_value_us)) || |
504 | (SQLITE_OK != sqlite3_bind_int64 (stmt, 6, rvalue)) || | 505 | (SQLITE_OK != sqlite3_bind_int64 (stmt, 6, rvalue)) || |
505 | (SQLITE_OK != | 506 | (SQLITE_OK != |
506 | sqlite3_bind_blob (stmt, 7, key, sizeof (struct GNUNET_HashCode), | 507 | sqlite3_bind_blob (stmt, 7, key, sizeof (struct GNUNET_HashCode), |
@@ -583,7 +584,7 @@ sqlite_plugin_update (void *cls, uint64_t uid, int delta, | |||
583 | int n; | 584 | int n; |
584 | 585 | ||
585 | if ((SQLITE_OK != sqlite3_bind_int (plugin->updPrio, 1, delta)) || | 586 | if ((SQLITE_OK != sqlite3_bind_int (plugin->updPrio, 1, delta)) || |
586 | (SQLITE_OK != sqlite3_bind_int64 (plugin->updPrio, 2, expire.abs_value)) | 587 | (SQLITE_OK != sqlite3_bind_int64 (plugin->updPrio, 2, expire.abs_value_us)) |
587 | || (SQLITE_OK != sqlite3_bind_int64 (plugin->updPrio, 3, uid))) | 588 | || (SQLITE_OK != sqlite3_bind_int64 (plugin->updPrio, 3, uid))) |
588 | { | 589 | { |
589 | LOG_SQLITE (plugin, msg, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 590 | LOG_SQLITE (plugin, msg, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
@@ -655,10 +656,10 @@ execute_get (struct Plugin *plugin, sqlite3_stmt * stmt, | |||
655 | -(size + GNUNET_DATASTORE_ENTRY_OVERHEAD)); | 656 | -(size + GNUNET_DATASTORE_ENTRY_OVERHEAD)); |
656 | break; | 657 | break; |
657 | } | 658 | } |
658 | expiration.abs_value = sqlite3_column_int64 (stmt, 3); | 659 | expiration.abs_value_us = sqlite3_column_int64 (stmt, 3); |
659 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", | 660 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", |
660 | "Found reply in database with expiration %llu\n", | 661 | "Found reply in database with expiration %s\n", |
661 | (unsigned long long) expiration.abs_value); | 662 | GNUNET_STRINGS_absolute_time_to_string (expiration)); |
662 | ret = proc (proc_cls, sqlite3_column_blob (stmt, 4) /* key */ , | 663 | ret = proc (proc_cls, sqlite3_column_blob (stmt, 4) /* key */ , |
663 | size, sqlite3_column_blob (stmt, 5) /* data */ , | 664 | size, sqlite3_column_blob (stmt, 5) /* data */ , |
664 | sqlite3_column_int (stmt, 0) /* type */ , | 665 | sqlite3_column_int (stmt, 0) /* type */ , |
@@ -1040,7 +1041,7 @@ sqlite_plugin_get_expiration (void *cls, PluginDatumProcessor proc, | |||
1040 | "Getting random block based on expiration and priority order.\n"); | 1041 | "Getting random block based on expiration and priority order.\n"); |
1041 | now = GNUNET_TIME_absolute_get (); | 1042 | now = GNUNET_TIME_absolute_get (); |
1042 | stmt = plugin->selExpi; | 1043 | stmt = plugin->selExpi; |
1043 | if (SQLITE_OK != sqlite3_bind_int64 (stmt, 1, now.abs_value)) | 1044 | if (SQLITE_OK != sqlite3_bind_int64 (stmt, 1, now.abs_value_us)) |
1044 | { | 1045 | { |
1045 | LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1046 | LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1046 | "sqlite3_bind_XXXX"); | 1047 | "sqlite3_bind_XXXX"); |
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c index 66ba416af..a88dd0c20 100644 --- a/src/datastore/test_datastore_api.c +++ b/src/datastore/test_datastore_api.c | |||
@@ -94,7 +94,7 @@ get_expiration (int i) | |||
94 | { | 94 | { |
95 | struct GNUNET_TIME_Absolute av; | 95 | struct GNUNET_TIME_Absolute av; |
96 | 96 | ||
97 | av.abs_value = now.abs_value + 20000000 - i * 1000; | 97 | av.abs_value_us = now.abs_value_us + 20000000000LL - i * 1000 * 1000LL; |
98 | return av; | 98 | return av; |
99 | } | 99 | } |
100 | 100 | ||
@@ -191,20 +191,21 @@ check_value (void *cls, const struct GNUNET_HashCode * key, size_t size, | |||
191 | return; | 191 | return; |
192 | } | 192 | } |
193 | #if 0 | 193 | #if 0 |
194 | FPRINTF (stderr, "Check value got `%s' of size %u, type %d, expire %llu\n", | 194 | FPRINTF (stderr, |
195 | "Check value got `%s' of size %u, type %d, expire %s\n", | ||
195 | GNUNET_h2s (key), (unsigned int) size, type, | 196 | GNUNET_h2s (key), (unsigned int) size, type, |
196 | (unsigned long long) expiration.abs_value); | 197 | GNUNET_STRINGS_absolute_time_to_string (expiration)); |
197 | FPRINTF (stderr, | 198 | FPRINTF (stderr, |
198 | "Check value iteration %d wants size %u, type %d, expire %llu\n", i, | 199 | "Check value iteration %d wants size %u, type %d, expire %s\n", i, |
199 | (unsigned int) get_size (i), get_type (i), | 200 | (unsigned int) get_size (i), get_type (i), |
200 | (unsigned long long) get_expiration (i).abs_value); | 201 | GNUNET_STRINGS_absolute_time_to_string (get_expiration(i))); |
201 | #endif | 202 | #endif |
202 | GNUNET_assert (size == get_size (i)); | 203 | GNUNET_assert (size == get_size (i)); |
203 | GNUNET_assert (0 == memcmp (data, get_data (i), size)); | 204 | GNUNET_assert (0 == memcmp (data, get_data (i), size)); |
204 | GNUNET_assert (type == get_type (i)); | 205 | GNUNET_assert (type == get_type (i)); |
205 | GNUNET_assert (priority == get_priority (i)); | 206 | GNUNET_assert (priority == get_priority (i)); |
206 | GNUNET_assert (anonymity == get_anonymity (i)); | 207 | GNUNET_assert (anonymity == get_anonymity (i)); |
207 | GNUNET_assert (expiration.abs_value == get_expiration (i).abs_value); | 208 | GNUNET_assert (expiration.abs_value_us == get_expiration (i).abs_value_us); |
208 | crc->offset++; | 209 | crc->offset++; |
209 | if (crc->i == 0) | 210 | if (crc->i == 0) |
210 | { | 211 | { |
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c index 9eae32f4a..8baeeede8 100644 --- a/src/datastore/test_datastore_api_management.c +++ b/src/datastore/test_datastore_api_management.c | |||
@@ -113,7 +113,7 @@ get_expiration (int i) | |||
113 | { | 113 | { |
114 | struct GNUNET_TIME_Absolute av; | 114 | struct GNUNET_TIME_Absolute av; |
115 | 115 | ||
116 | av.abs_value = now.abs_value + i * 1000; | 116 | av.abs_value_us = now.abs_value_us + i * 1000 * 1000LL; |
117 | return av; | 117 | return av; |
118 | } | 118 | } |
119 | 119 | ||
@@ -159,7 +159,7 @@ check_value (void *cls, const struct GNUNET_HashCode * key, size_t size, | |||
159 | GNUNET_assert (type == get_type (i)); | 159 | GNUNET_assert (type == get_type (i)); |
160 | GNUNET_assert (priority == get_priority (i)); | 160 | GNUNET_assert (priority == get_priority (i)); |
161 | GNUNET_assert (anonymity == get_anonymity (i)); | 161 | GNUNET_assert (anonymity == get_anonymity (i)); |
162 | GNUNET_assert (expiration.abs_value == get_expiration (i).abs_value); | 162 | GNUNET_assert (expiration.abs_value_us == get_expiration (i).abs_value_us); |
163 | crc->offset++; | 163 | crc->offset++; |
164 | crc->i--; | 164 | crc->i--; |
165 | if (crc->i == 0) | 165 | if (crc->i == 0) |
diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c index adfacef0c..3efd7b4ce 100644 --- a/src/datastore/test_plugin_datastore.c +++ b/src/datastore/test_plugin_datastore.c | |||
@@ -158,8 +158,9 @@ iterate_one_shot (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
158 | guid = uid; | 158 | guid = uid; |
159 | crc->phase++; | 159 | crc->phase++; |
160 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 160 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
161 | "Found result type=%u, priority=%u, size=%u, expire=%llu, key %s\n", | 161 | "Found result type=%u, priority=%u, size=%u, expire=%s, key %s\n", |
162 | type, priority, size, (unsigned long long) expiration.abs_value, | 162 | type, priority, size, |
163 | GNUNET_STRINGS_absolute_time_to_string (expiration), | ||
163 | GNUNET_h2s (key)); | 164 | GNUNET_h2s (key)); |
164 | GNUNET_SCHEDULER_add_now (&test, crc); | 165 | GNUNET_SCHEDULER_add_now (&test, crc); |
165 | return GNUNET_OK; | 166 | return GNUNET_OK; |
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c index e15893bed..70b1500cc 100644 --- a/src/dht/gnunet-service-dht_clients.c +++ b/src/dht/gnunet-service-dht_clients.c | |||
@@ -461,11 +461,11 @@ transmit_next_request_task (void *cls, | |||
461 | { | 461 | { |
462 | cqr->hnode = NULL; | 462 | cqr->hnode = NULL; |
463 | delay = GNUNET_TIME_absolute_get_remaining (cqr->retry_time); | 463 | delay = GNUNET_TIME_absolute_get_remaining (cqr->retry_time); |
464 | if (delay.rel_value > 0) | 464 | if (delay.rel_value_us > 0) |
465 | { | 465 | { |
466 | cqr->hnode = | 466 | cqr->hnode = |
467 | GNUNET_CONTAINER_heap_insert (retry_heap, cqr, | 467 | GNUNET_CONTAINER_heap_insert (retry_heap, cqr, |
468 | cqr->retry_time.abs_value); | 468 | cqr->retry_time.abs_value_us); |
469 | retry_task = | 469 | retry_task = |
470 | GNUNET_SCHEDULER_add_delayed (delay, &transmit_next_request_task, | 470 | GNUNET_SCHEDULER_add_delayed (delay, &transmit_next_request_task, |
471 | NULL); | 471 | NULL); |
@@ -474,7 +474,7 @@ transmit_next_request_task (void *cls, | |||
474 | transmit_request (cqr); | 474 | transmit_request (cqr); |
475 | cqr->hnode = | 475 | cqr->hnode = |
476 | GNUNET_CONTAINER_heap_insert (retry_heap, cqr, | 476 | GNUNET_CONTAINER_heap_insert (retry_heap, cqr, |
477 | cqr->retry_time.abs_value); | 477 | cqr->retry_time.abs_value_us); |
478 | } | 478 | } |
479 | } | 479 | } |
480 | 480 | ||
diff --git a/src/dht/gnunet-service-dht_hello.c b/src/dht/gnunet-service-dht_hello.c index 32a99203f..2ce7f1925 100644 --- a/src/dht/gnunet-service-dht_hello.c +++ b/src/dht/gnunet-service-dht_hello.c | |||
@@ -76,7 +76,7 @@ process_hello (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
76 | if (hello == NULL) | 76 | if (hello == NULL) |
77 | return; | 77 | return; |
78 | ex = GNUNET_HELLO_get_last_expiration (hello); | 78 | ex = GNUNET_HELLO_get_last_expiration (hello); |
79 | if (GNUNET_TIME_absolute_get_remaining (ex).rel_value == 0) | 79 | if (0 == GNUNET_TIME_absolute_get_remaining (ex).rel_value_us) |
80 | return; | 80 | return; |
81 | GNUNET_STATISTICS_update (GDS_stats, | 81 | GNUNET_STATISTICS_update (GDS_stats, |
82 | gettext_noop ("# HELLOs obtained from peerinfo"), 1, | 82 | gettext_noop ("# HELLOs obtained from peerinfo"), 1, |
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 16955629c..3041cccfe 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2009-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -602,10 +602,10 @@ send_find_peer_message (void *cls, | |||
602 | GNUNET_CONTAINER_bloomfilter_free (peer_bf); | 602 | GNUNET_CONTAINER_bloomfilter_free (peer_bf); |
603 | GNUNET_CONTAINER_bloomfilter_free (bcc.bloom); | 603 | GNUNET_CONTAINER_bloomfilter_free (bcc.bloom); |
604 | /* schedule next round */ | 604 | /* schedule next round */ |
605 | next_send_time.rel_value = | 605 | next_send_time.rel_value_us = |
606 | DHT_MINIMUM_FIND_PEER_INTERVAL.rel_value + | 606 | DHT_MINIMUM_FIND_PEER_INTERVAL.rel_value_us + |
607 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | 607 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, |
608 | DHT_MAXIMUM_FIND_PEER_INTERVAL.rel_value / | 608 | DHT_MAXIMUM_FIND_PEER_INTERVAL.rel_value_us / |
609 | (newly_found_peers + 1)); | 609 | (newly_found_peers + 1)); |
610 | newly_found_peers = 0; | 610 | newly_found_peers = 0; |
611 | find_peer_task = | 611 | find_peer_task = |
@@ -757,7 +757,7 @@ core_transmit_notify (void *cls, size_t size, void *buf) | |||
757 | 757 | ||
758 | peer->th = NULL; | 758 | peer->th = NULL; |
759 | while ((NULL != (pending = peer->head)) && | 759 | while ((NULL != (pending = peer->head)) && |
760 | (GNUNET_TIME_absolute_get_remaining (pending->timeout).rel_value == 0)) | 760 | (0 == GNUNET_TIME_absolute_get_remaining (pending->timeout).rel_value_us)) |
761 | { | 761 | { |
762 | peer->pending_count--; | 762 | peer->pending_count--; |
763 | GNUNET_CONTAINER_DLL_remove (peer->head, peer->tail, pending); | 763 | GNUNET_CONTAINER_DLL_remove (peer->head, peer->tail, pending); |
diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c index efcdf0e14..8889de4fb 100644 --- a/src/dht/gnunet-service-dht_routing.c +++ b/src/dht/gnunet-service-dht_routing.c | |||
@@ -421,7 +421,7 @@ GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender, | |||
421 | } | 421 | } |
422 | recent_req->heap_node = | 422 | recent_req->heap_node = |
423 | GNUNET_CONTAINER_heap_insert (recent_heap, recent_req, | 423 | GNUNET_CONTAINER_heap_insert (recent_heap, recent_req, |
424 | GNUNET_TIME_absolute_get ().abs_value); | 424 | GNUNET_TIME_absolute_get ().abs_value_us); |
425 | GNUNET_CONTAINER_multihashmap_put (recent_map, key, recent_req, | 425 | GNUNET_CONTAINER_multihashmap_put (recent_map, key, recent_req, |
426 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 426 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
427 | 427 | ||
diff --git a/src/dns/dnsparser.c b/src/dns/dnsparser.c index 6ddfebb11..18ef4c219 100644 --- a/src/dns/dnsparser.c +++ b/src/dns/dnsparser.c | |||
@@ -891,7 +891,7 @@ add_record (char *dst, | |||
891 | } | 891 | } |
892 | rl.type = htons (record->type); | 892 | rl.type = htons (record->type); |
893 | rl.class = htons (record->class); | 893 | rl.class = htons (record->class); |
894 | rl.ttl = htonl (GNUNET_TIME_absolute_get_remaining (record->expiration_time).rel_value / 1000); /* in seconds */ | 894 | rl.ttl = htonl (GNUNET_TIME_absolute_get_remaining (record->expiration_time).rel_value_us / 1000LL / 1000LL); /* in seconds */ |
895 | rl.data_len = htons ((uint16_t) (pos - (*off + sizeof (struct record_line)))); | 895 | rl.data_len = htons ((uint16_t) (pos - (*off + sizeof (struct record_line)))); |
896 | memcpy (&dst[*off], &rl, sizeof (struct record_line)); | 896 | memcpy (&dst[*off], &rl, sizeof (struct record_line)); |
897 | *off = pos; | 897 | *off = pos; |
diff --git a/src/dns/dnsstub.c b/src/dns/dnsstub.c index 3b30d3e63..0e130a77f 100644 --- a/src/dns/dnsstub.c +++ b/src/dns/dnsstub.c | |||
@@ -447,7 +447,7 @@ do_dns_read (struct GNUNET_DNSSTUB_RequestSocket *rs, | |||
447 | (0 != memcmp (&rs->addr, | 447 | (0 != memcmp (&rs->addr, |
448 | &addr, | 448 | &addr, |
449 | addrlen)) || | 449 | addrlen)) || |
450 | (0 == GNUNET_TIME_absolute_get_remaining (rs->timeout).rel_value) ) | 450 | (0 == GNUNET_TIME_absolute_get_remaining (rs->timeout).rel_value_us) ) |
451 | { | 451 | { |
452 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 452 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
453 | "Request timeout or invalid sender address; ignoring reply\n"); | 453 | "Request timeout or invalid sender address; ignoring reply\n"); |
diff --git a/src/dns/gnunet-dns-monitor.c b/src/dns/gnunet-dns-monitor.c index 747a87556..ece96db71 100644 --- a/src/dns/gnunet-dns-monitor.c +++ b/src/dns/gnunet-dns-monitor.c | |||
@@ -214,7 +214,7 @@ display_record (const struct GNUNET_DNSPARSER_Record *record) | |||
214 | get_type (record->type), | 214 | get_type (record->type), |
215 | record->name, | 215 | record->name, |
216 | format, | 216 | format, |
217 | (unsigned int) (GNUNET_TIME_absolute_get_remaining (record->expiration_time).rel_value / 1000)); | 217 | (unsigned int) (GNUNET_TIME_absolute_get_remaining (record->expiration_time).rel_value_us / 1000LL / 1000LL)); |
218 | GNUNET_free_non_null (tmp); | 218 | GNUNET_free_non_null (tmp); |
219 | } | 219 | } |
220 | 220 | ||
diff --git a/src/dns/plugin_block_dns.c b/src/dns/plugin_block_dns.c index d8f3cbb6f..58301e095 100644 --- a/src/dns/plugin_block_dns.c +++ b/src/dns/plugin_block_dns.c | |||
@@ -87,7 +87,7 @@ block_plugin_dns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, | |||
87 | 87 | ||
88 | if (0 == | 88 | if (0 == |
89 | GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh | 89 | GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh |
90 | (rec->expiration_time)).rel_value) | 90 | (rec->expiration_time)).rel_value_us) |
91 | { | 91 | { |
92 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "DNS-Block is invalid: Timeout\n"); | 92 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "DNS-Block is invalid: Timeout\n"); |
93 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 93 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index 358e07434..4e15f3db4 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c | |||
@@ -674,7 +674,7 @@ get_redirect_state (int af, | |||
674 | if (NULL == state_key) | 674 | if (NULL == state_key) |
675 | GNUNET_CONTAINER_heap_update_cost (connections_heap, | 675 | GNUNET_CONTAINER_heap_update_cost (connections_heap, |
676 | state->specifics.tcp_udp.heap_node, | 676 | state->specifics.tcp_udp.heap_node, |
677 | GNUNET_TIME_absolute_get ().abs_value); | 677 | GNUNET_TIME_absolute_get ().abs_value_us); |
678 | return state; | 678 | return state; |
679 | } | 679 | } |
680 | 680 | ||
@@ -1497,7 +1497,7 @@ setup_state_record (struct TunnelState *state) | |||
1497 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 1497 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
1498 | state->specifics.tcp_udp.heap_node = GNUNET_CONTAINER_heap_insert (connections_heap, | 1498 | state->specifics.tcp_udp.heap_node = GNUNET_CONTAINER_heap_insert (connections_heap, |
1499 | state, | 1499 | state, |
1500 | GNUNET_TIME_absolute_get ().abs_value); | 1500 | GNUNET_TIME_absolute_get ().abs_value_us); |
1501 | while (GNUNET_CONTAINER_heap_get_size (connections_heap) > max_connections) | 1501 | while (GNUNET_CONTAINER_heap_get_size (connections_heap) > max_connections) |
1502 | { | 1502 | { |
1503 | s = GNUNET_CONTAINER_heap_remove_root (connections_heap); | 1503 | s = GNUNET_CONTAINER_heap_remove_root (connections_heap); |
diff --git a/src/experimentation/gnunet-daemon-experimentation_experiments.c b/src/experimentation/gnunet-daemon-experimentation_experiments.c index 99348a2cb..891865b39 100644 --- a/src/experimentation/gnunet-daemon-experimentation_experiments.c +++ b/src/experimentation/gnunet-daemon-experimentation_experiments.c | |||
@@ -158,7 +158,7 @@ find_it (void *cls, | |||
158 | 158 | ||
159 | if (0 != strcmp(e->name, find_ctx->name)) | 159 | if (0 != strcmp(e->name, find_ctx->name)) |
160 | return GNUNET_OK; | 160 | return GNUNET_OK; |
161 | if (e->version.abs_value != find_ctx->version.abs_value) | 161 | if (e->version.abs_value_us != find_ctx->version.abs_value_us) |
162 | return GNUNET_OK; | 162 | return GNUNET_OK; |
163 | 163 | ||
164 | find_ctx->res = e; | 164 | find_ctx->res = e; |
@@ -272,8 +272,8 @@ int GNUNET_EXPERIMENTATION_experiments_add (struct Issuer *i, | |||
272 | e->name, | 272 | e->name, |
273 | GNUNET_STRINGS_absolute_time_to_string (start), | 273 | GNUNET_STRINGS_absolute_time_to_string (start), |
274 | GNUNET_STRINGS_absolute_time_to_string (stop), | 274 | GNUNET_STRINGS_absolute_time_to_string (stop), |
275 | (long long unsigned int) frequency.rel_value / 1000, | 275 | (long long unsigned int) frequency.rel_value_us / 1000000LL, |
276 | (long long unsigned int) duration.rel_value / 1000); | 276 | (long long unsigned int) duration.rel_value_us / 1000000LL); |
277 | GNUNET_CONTAINER_multihashmap_put (experiments, &e->issuer.hashPubKey, e, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 277 | GNUNET_CONTAINER_multihashmap_put (experiments, &e->issuer.hashPubKey, e, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
278 | GNUNET_STATISTICS_set (GED_stats, "# experiments", GNUNET_CONTAINER_multihashmap_size (experiments), GNUNET_NO); | 278 | GNUNET_STATISTICS_set (GED_stats, "# experiments", GNUNET_CONTAINER_multihashmap_size (experiments), GNUNET_NO); |
279 | 279 | ||
@@ -336,7 +336,7 @@ void exp_file_iterator (void *cls, | |||
336 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Experiment `%s': Version missing or invalid \n"), name); | 336 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Experiment `%s': Version missing or invalid \n"), name); |
337 | return; | 337 | return; |
338 | } | 338 | } |
339 | version.abs_value = number; | 339 | version.abs_value_us = number; // FIXME: what is this supposed to be? Version != TIME!??? |
340 | 340 | ||
341 | /* Required capabilities */ | 341 | /* Required capabilities */ |
342 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "CAPABILITIES", &number)) | 342 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "CAPABILITIES", &number)) |
@@ -358,14 +358,14 @@ void exp_file_iterator (void *cls, | |||
358 | 358 | ||
359 | 359 | ||
360 | 360 | ||
361 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "START", (long long unsigned int *) &start.abs_value)) | 361 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "START", (long long unsigned int *) &start.abs_value_us)) |
362 | start = GNUNET_TIME_UNIT_ZERO_ABS; | 362 | start = GNUNET_TIME_UNIT_ZERO_ABS; |
363 | 363 | ||
364 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (exp, name, "FREQUENCY", &frequency)) | 364 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (exp, name, "FREQUENCY", &frequency)) |
365 | frequency = EXP_DEFAULT_EXP_FREQ; | 365 | frequency = EXP_DEFAULT_EXP_FREQ; |
366 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (exp, name, "DURATION", &duration)) | 366 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (exp, name, "DURATION", &duration)) |
367 | duration = EXP_DEFAULT_EXP_DUR; | 367 | duration = EXP_DEFAULT_EXP_DUR; |
368 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "STOP", (long long unsigned int *)&stop.abs_value)) | 368 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (exp, name, "STOP", (long long unsigned int *)&stop.abs_value_us)) |
369 | stop = GNUNET_TIME_UNIT_FOREVER_ABS; | 369 | stop = GNUNET_TIME_UNIT_FOREVER_ABS; |
370 | 370 | ||
371 | GNUNET_EXPERIMENTATION_experiments_add (i, name, issuer, version, | 371 | GNUNET_EXPERIMENTATION_experiments_add (i, name, issuer, version, |
diff --git a/src/experimentation/gnunet-daemon-experimentation_scheduler.c b/src/experimentation/gnunet-daemon-experimentation_scheduler.c index 784baa4d4..34142fabb 100644 --- a/src/experimentation/gnunet-daemon-experimentation_scheduler.c +++ b/src/experimentation/gnunet-daemon-experimentation_scheduler.c | |||
@@ -133,7 +133,7 @@ static void run_experiment_inbound (void *cls,const struct GNUNET_SCHEDULER_Task | |||
133 | se->state = REQUESTED; | 133 | se->state = REQUESTED; |
134 | /* Schedule to run */ | 134 | /* Schedule to run */ |
135 | start = GNUNET_TIME_absolute_get_remaining(se->e->start); | 135 | start = GNUNET_TIME_absolute_get_remaining(se->e->start); |
136 | if (0 == start.rel_value) | 136 | if (0 == start.rel_value_us) |
137 | se->task = GNUNET_SCHEDULER_add_now (&run_experiment_inbound, se); | 137 | se->task = GNUNET_SCHEDULER_add_now (&run_experiment_inbound, se); |
138 | else | 138 | else |
139 | se->task = GNUNET_SCHEDULER_add_delayed (start, &run_experiment_inbound, se); | 139 | se->task = GNUNET_SCHEDULER_add_delayed (start, &run_experiment_inbound, se); |
@@ -155,7 +155,7 @@ static void run_experiment_inbound (void *cls,const struct GNUNET_SCHEDULER_Task | |||
155 | 155 | ||
156 | /* Reschedule */ | 156 | /* Reschedule */ |
157 | end = GNUNET_TIME_absolute_get_remaining(GNUNET_TIME_absolute_add (se->e->stop, se->e->frequency)); | 157 | end = GNUNET_TIME_absolute_get_remaining(GNUNET_TIME_absolute_add (se->e->stop, se->e->frequency)); |
158 | if (0 == end.rel_value) | 158 | if (0 == end.rel_value_us) |
159 | { | 159 | { |
160 | se->state = STOPPED; | 160 | se->state = STOPPED; |
161 | return; /* End of experiment is reached */ | 161 | return; /* End of experiment is reached */ |
@@ -201,7 +201,7 @@ static void run_experiment_outbound (void *cls,const struct GNUNET_SCHEDULER_Tas | |||
201 | 201 | ||
202 | /* Reschedule */ | 202 | /* Reschedule */ |
203 | end = GNUNET_TIME_absolute_get_remaining(GNUNET_TIME_absolute_add (se->e->stop, se->e->frequency)); | 203 | end = GNUNET_TIME_absolute_get_remaining(GNUNET_TIME_absolute_add (se->e->stop, se->e->frequency)); |
204 | if (0 == end.rel_value) | 204 | if (0 == end.rel_value_us) |
205 | { | 205 | { |
206 | se->state = STOPPED; | 206 | se->state = STOPPED; |
207 | return; /* End of experiment is reached */ | 207 | return; /* End of experiment is reached */ |
@@ -328,7 +328,7 @@ GED_scheduler_add (struct Node *n, struct Experiment *e, int outbound) | |||
328 | 328 | ||
329 | start = GNUNET_TIME_absolute_get_remaining(e->start); | 329 | start = GNUNET_TIME_absolute_get_remaining(e->start); |
330 | end = GNUNET_TIME_absolute_get_remaining(e->stop); | 330 | end = GNUNET_TIME_absolute_get_remaining(e->stop); |
331 | if (0 == end.rel_value) | 331 | if (0 == end.rel_value_us) |
332 | return; /* End of experiment is reached */ | 332 | return; /* End of experiment is reached */ |
333 | 333 | ||
334 | /* Add additional checks here if required */ | 334 | /* Add additional checks here if required */ |
@@ -340,7 +340,7 @@ GED_scheduler_add (struct Node *n, struct Experiment *e, int outbound) | |||
340 | 340 | ||
341 | if (GNUNET_YES == outbound) | 341 | if (GNUNET_YES == outbound) |
342 | { | 342 | { |
343 | if (0 == start.rel_value) | 343 | if (0 == start.rel_value_us) |
344 | se->task = GNUNET_SCHEDULER_add_now (&run_experiment_outbound, se); | 344 | se->task = GNUNET_SCHEDULER_add_now (&run_experiment_outbound, se); |
345 | else | 345 | else |
346 | se->task = GNUNET_SCHEDULER_add_delayed (start, &run_experiment_outbound, se); | 346 | se->task = GNUNET_SCHEDULER_add_delayed (start, &run_experiment_outbound, se); |
@@ -348,7 +348,7 @@ GED_scheduler_add (struct Node *n, struct Experiment *e, int outbound) | |||
348 | } | 348 | } |
349 | else | 349 | else |
350 | { | 350 | { |
351 | if (0 == start.rel_value) | 351 | if (0 == start.rel_value_us) |
352 | se->task = GNUNET_SCHEDULER_add_now (&run_experiment_inbound, se); | 352 | se->task = GNUNET_SCHEDULER_add_now (&run_experiment_inbound, se); |
353 | else | 353 | else |
354 | se->task = GNUNET_SCHEDULER_add_delayed (start, &run_experiment_inbound, se); | 354 | se->task = GNUNET_SCHEDULER_add_delayed (start, &run_experiment_inbound, se); |
diff --git a/src/fragmentation/defragmentation.c b/src/fragmentation/defragmentation.c index 2d3f4a57b..f42207046 100644 --- a/src/fragmentation/defragmentation.c +++ b/src/fragmentation/defragmentation.c | |||
@@ -354,13 +354,13 @@ estimate_latency (struct MessageContext *mc) | |||
354 | for (i = 0; i < total; i++) | 354 | for (i = 0; i < total; i++) |
355 | { | 355 | { |
356 | x[i] = (double) i; | 356 | x[i] = (double) i; |
357 | y[i] = (double) (first[i].time.abs_value - first[0].time.abs_value); | 357 | y[i] = (double) (first[i].time.abs_value_us - first[0].time.abs_value_us); |
358 | } | 358 | } |
359 | gsl_fit_mul (x, 1, y, 1, total, &c1, &cov11, &sumsq); | 359 | gsl_fit_mul (x, 1, y, 1, total, &c1, &cov11, &sumsq); |
360 | c1 += sqrt (sumsq); /* add 1 std dev */ | 360 | c1 += sqrt (sumsq); /* add 1 std dev */ |
361 | ret.rel_value = (uint64_t) c1; | 361 | ret.rel_value_us = (uint64_t) c1; |
362 | if (ret.rel_value == 0) | 362 | if (0 == ret.rel_value_us) |
363 | ret = GNUNET_TIME_UNIT_MILLISECONDS; /* always at least 1 */ | 363 | ret = GNUNET_TIME_UNIT_MICROSECONDS; /* always at least 1 */ |
364 | return ret; | 364 | return ret; |
365 | } | 365 | } |
366 | 366 | ||
@@ -381,7 +381,7 @@ discard_oldest_mc (struct GNUNET_DEFRAGMENT_Context *dc) | |||
381 | while (NULL != pos) | 381 | while (NULL != pos) |
382 | { | 382 | { |
383 | if ((old == NULL) || | 383 | if ((old == NULL) || |
384 | (old->last_update.abs_value > pos->last_update.abs_value)) | 384 | (old->last_update.abs_value_us > pos->last_update.abs_value_us)) |
385 | old = pos; | 385 | old = pos; |
386 | pos = pos->next; | 386 | pos = pos->next; |
387 | } | 387 | } |
diff --git a/src/fragmentation/fragmentation.c b/src/fragmentation/fragmentation.c index f859b32c7..39a5af814 100644 --- a/src/fragmentation/fragmentation.c +++ b/src/fragmentation/fragmentation.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2009, 2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2009-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -180,7 +180,7 @@ transmit_next (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
180 | delay = GNUNET_BANDWIDTH_tracker_get_delay (fc->tracker, fsize); | 180 | delay = GNUNET_BANDWIDTH_tracker_get_delay (fc->tracker, fsize); |
181 | else | 181 | else |
182 | delay = GNUNET_TIME_UNIT_ZERO; | 182 | delay = GNUNET_TIME_UNIT_ZERO; |
183 | if (delay.rel_value > 0) | 183 | if (delay.rel_value_us > 0) |
184 | { | 184 | { |
185 | fc->task = GNUNET_SCHEDULER_add_delayed (delay, &transmit_next, fc); | 185 | fc->task = GNUNET_SCHEDULER_add_delayed (delay, &transmit_next, fc); |
186 | return; | 186 | return; |
@@ -207,7 +207,7 @@ transmit_next (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
207 | GNUNET_BANDWIDTH_tracker_consume (fc->tracker, fsize); | 207 | GNUNET_BANDWIDTH_tracker_consume (fc->tracker, fsize); |
208 | GNUNET_STATISTICS_update (fc->stats, _("# fragments transmitted"), 1, | 208 | GNUNET_STATISTICS_update (fc->stats, _("# fragments transmitted"), 1, |
209 | GNUNET_NO); | 209 | GNUNET_NO); |
210 | if (0 != fc->last_round.abs_value) | 210 | if (0 != fc->last_round.abs_value_us) |
211 | GNUNET_STATISTICS_update (fc->stats, _("# fragments retransmitted"), 1, | 211 | GNUNET_STATISTICS_update (fc->stats, _("# fragments retransmitted"), 1, |
212 | GNUNET_NO); | 212 | GNUNET_NO); |
213 | 213 | ||
@@ -367,8 +367,8 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, | |||
367 | /* normal ACK, can update running average of delay... */ | 367 | /* normal ACK, can update running average of delay... */ |
368 | fc->wack = GNUNET_NO; | 368 | fc->wack = GNUNET_NO; |
369 | ndelay = GNUNET_TIME_absolute_get_duration (fc->last_round); | 369 | ndelay = GNUNET_TIME_absolute_get_duration (fc->last_round); |
370 | fc->ack_delay.rel_value = | 370 | fc->ack_delay.rel_value_us = |
371 | (ndelay.rel_value / fc->num_transmissions + 3 * fc->ack_delay.rel_value) / 4; | 371 | (ndelay.rel_value_us / fc->num_transmissions + 3 * fc->ack_delay.rel_value_us) / 4; |
372 | fc->num_transmissions = 0; | 372 | fc->num_transmissions = 0; |
373 | /* calculate ratio msg sent vs. msg acked */ | 373 | /* calculate ratio msg sent vs. msg acked */ |
374 | ack_cnt = 0; | 374 | ack_cnt = 0; |
@@ -392,11 +392,11 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, | |||
392 | { | 392 | { |
393 | /* some loss, slow down proportionally */ | 393 | /* some loss, slow down proportionally */ |
394 | fprintf (stderr, "Prop loss\n"); | 394 | fprintf (stderr, "Prop loss\n"); |
395 | fc->msg_delay.rel_value = ((fc->msg_delay.rel_value * ack_cnt) / snd_cnt); | 395 | fc->msg_delay.rel_value_us = ((fc->msg_delay.rel_value_us * ack_cnt) / snd_cnt); |
396 | } | 396 | } |
397 | else if (1 < fc->msg_delay.rel_value) | 397 | else if (100 < fc->msg_delay.rel_value_us) |
398 | { | 398 | { |
399 | fc->msg_delay.rel_value--; /* try a bit faster */ | 399 | fc->msg_delay.rel_value_us -= 100; /* try a bit faster */ |
400 | } | 400 | } |
401 | fc->msg_delay = GNUNET_TIME_relative_min (fc->msg_delay, | 401 | fc->msg_delay = GNUNET_TIME_relative_min (fc->msg_delay, |
402 | GNUNET_TIME_UNIT_SECONDS); | 402 | GNUNET_TIME_UNIT_SECONDS); |
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c index 9676f2e3c..91c568554 100644 --- a/src/fs/fs_api.c +++ b/src/fs/fs_api.c | |||
@@ -164,7 +164,7 @@ process_job_queue (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
164 | run_time = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 2); | 164 | run_time = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 2); |
165 | end_time = GNUNET_TIME_absolute_add (qe->start_time, run_time); | 165 | end_time = GNUNET_TIME_absolute_add (qe->start_time, run_time); |
166 | rst = GNUNET_TIME_absolute_get_remaining (end_time); | 166 | rst = GNUNET_TIME_absolute_get_remaining (end_time); |
167 | if (0 == rst.rel_value) | 167 | if (0 == rst.rel_value_us) |
168 | { | 168 | { |
169 | num_probes_expired++; | 169 | num_probes_expired++; |
170 | stop_job (qe); | 170 | stop_job (qe); |
@@ -181,7 +181,7 @@ process_job_queue (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
181 | qe->blocks * qe->start_times); | 181 | qe->blocks * qe->start_times); |
182 | end_time = GNUNET_TIME_absolute_add (qe->start_time, run_time); | 182 | end_time = GNUNET_TIME_absolute_add (qe->start_time, run_time); |
183 | rst = GNUNET_TIME_absolute_get_remaining (end_time); | 183 | rst = GNUNET_TIME_absolute_get_remaining (end_time); |
184 | if (0 == rst.rel_value) | 184 | if (0 == rst.rel_value_us) |
185 | { | 185 | { |
186 | num_downloads_expired++; | 186 | num_downloads_expired++; |
187 | stop_job (qe); | 187 | stop_job (qe); |
@@ -781,7 +781,7 @@ write_start_time (struct GNUNET_BIO_WriteHandle *wh, | |||
781 | struct GNUNET_TIME_Relative dur; | 781 | struct GNUNET_TIME_Relative dur; |
782 | 782 | ||
783 | dur = GNUNET_TIME_absolute_get_duration (timestamp); | 783 | dur = GNUNET_TIME_absolute_get_duration (timestamp); |
784 | return GNUNET_BIO_write_int64 (wh, dur.rel_value); | 784 | return GNUNET_BIO_write_int64 (wh, dur.rel_value_us); |
785 | } | 785 | } |
786 | 786 | ||
787 | 787 | ||
@@ -805,7 +805,7 @@ read_start_time (struct GNUNET_BIO_ReadHandle *rh, | |||
805 | { | 805 | { |
806 | struct GNUNET_TIME_Relative dur; | 806 | struct GNUNET_TIME_Relative dur; |
807 | 807 | ||
808 | if (GNUNET_OK != GNUNET_BIO_read_int64 (rh, &dur.rel_value)) | 808 | if (GNUNET_OK != GNUNET_BIO_read_int64 (rh, &dur.rel_value_us)) |
809 | return GNUNET_SYSERR; | 809 | return GNUNET_SYSERR; |
810 | *timestamp = GNUNET_TIME_absolute_subtract (GNUNET_TIME_absolute_get (), dur); | 810 | *timestamp = GNUNET_TIME_absolute_subtract (GNUNET_TIME_absolute_get (), dur); |
811 | return GNUNET_OK; | 811 | return GNUNET_OK; |
@@ -871,7 +871,7 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h, const char *fn, | |||
871 | || (GNUNET_OK != | 871 | || (GNUNET_OK != |
872 | GNUNET_BIO_read_string (rh, "fn", &ret->filename, 16 * 1024)) || | 872 | GNUNET_BIO_read_string (rh, "fn", &ret->filename, 16 * 1024)) || |
873 | (GNUNET_OK != | 873 | (GNUNET_OK != |
874 | GNUNET_BIO_read_int64 (rh, &ret->bo.expiration_time.abs_value)) || | 874 | GNUNET_BIO_read_int64 (rh, &ret->bo.expiration_time.abs_value_us)) || |
875 | (GNUNET_OK != GNUNET_BIO_read_int32 (rh, &ret->bo.anonymity_level)) || | 875 | (GNUNET_OK != GNUNET_BIO_read_int32 (rh, &ret->bo.anonymity_level)) || |
876 | (GNUNET_OK != GNUNET_BIO_read_int32 (rh, &ret->bo.content_priority)) || | 876 | (GNUNET_OK != GNUNET_BIO_read_int32 (rh, &ret->bo.content_priority)) || |
877 | (GNUNET_OK != GNUNET_BIO_read_int32 (rh, &ret->bo.replication_level))) | 877 | (GNUNET_OK != GNUNET_BIO_read_int32 (rh, &ret->bo.replication_level))) |
@@ -1273,7 +1273,7 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *fi) | |||
1273 | (GNUNET_OK != GNUNET_BIO_write_string (wh, fi->emsg)) || | 1273 | (GNUNET_OK != GNUNET_BIO_write_string (wh, fi->emsg)) || |
1274 | (GNUNET_OK != GNUNET_BIO_write_string (wh, fi->filename)) || | 1274 | (GNUNET_OK != GNUNET_BIO_write_string (wh, fi->filename)) || |
1275 | (GNUNET_OK != | 1275 | (GNUNET_OK != |
1276 | GNUNET_BIO_write_int64 (wh, fi->bo.expiration_time.abs_value)) || | 1276 | GNUNET_BIO_write_int64 (wh, fi->bo.expiration_time.abs_value_us)) || |
1277 | (GNUNET_OK != GNUNET_BIO_write_int32 (wh, fi->bo.anonymity_level)) || | 1277 | (GNUNET_OK != GNUNET_BIO_write_int32 (wh, fi->bo.anonymity_level)) || |
1278 | (GNUNET_OK != GNUNET_BIO_write_int32 (wh, fi->bo.content_priority)) || | 1278 | (GNUNET_OK != GNUNET_BIO_write_int32 (wh, fi->bo.content_priority)) || |
1279 | (GNUNET_OK != GNUNET_BIO_write_int32 (wh, fi->bo.replication_level))) | 1279 | (GNUNET_OK != GNUNET_BIO_write_int32 (wh, fi->bo.replication_level))) |
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 2371e6544..a86df253a 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -1082,7 +1082,7 @@ process_result_with_request (void *cls, const struct GNUNET_HashCode * key, | |||
1082 | pi.value.download.specifics.progress.depth = dr->depth; | 1082 | pi.value.download.specifics.progress.depth = dr->depth; |
1083 | pi.value.download.specifics.progress.respect_offered = prc->respect_offered; | 1083 | pi.value.download.specifics.progress.respect_offered = prc->respect_offered; |
1084 | pi.value.download.specifics.progress.num_transmissions = prc->num_transmissions; | 1084 | pi.value.download.specifics.progress.num_transmissions = prc->num_transmissions; |
1085 | if (prc->last_transmission.abs_value != GNUNET_TIME_UNIT_FOREVER_ABS.abs_value) | 1085 | if (prc->last_transmission.abs_value_us != GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) |
1086 | pi.value.download.specifics.progress.block_download_duration | 1086 | pi.value.download.specifics.progress.block_download_duration |
1087 | = GNUNET_TIME_absolute_get_duration (prc->last_transmission); | 1087 | = GNUNET_TIME_absolute_get_duration (prc->last_transmission); |
1088 | else | 1088 | else |
@@ -1437,7 +1437,7 @@ try_reconnect (struct GNUNET_FS_DownloadContext *dc) | |||
1437 | dc->in_receive = GNUNET_NO; | 1437 | dc->in_receive = GNUNET_NO; |
1438 | dc->client = NULL; | 1438 | dc->client = NULL; |
1439 | } | 1439 | } |
1440 | if (0 == dc->reconnect_backoff.rel_value) | 1440 | if (0 == dc->reconnect_backoff.rel_value_us) |
1441 | dc->reconnect_backoff = GNUNET_TIME_UNIT_MILLISECONDS; | 1441 | dc->reconnect_backoff = GNUNET_TIME_UNIT_MILLISECONDS; |
1442 | else | 1442 | else |
1443 | dc->reconnect_backoff = GNUNET_TIME_STD_BACKOFF (dc->reconnect_backoff); | 1443 | dc->reconnect_backoff = GNUNET_TIME_STD_BACKOFF (dc->reconnect_backoff); |
diff --git a/src/fs/fs_misc.c b/src/fs/fs_misc.c index 89dc48683..ee24fa250 100644 --- a/src/fs/fs_misc.c +++ b/src/fs/fs_misc.c | |||
@@ -202,7 +202,7 @@ GNUNET_FS_year_to_time (unsigned int year) | |||
202 | t.tm_yday = 1; | 202 | t.tm_yday = 1; |
203 | tp = mktime (&t); | 203 | tp = mktime (&t); |
204 | GNUNET_break (tp != (time_t) - 1); | 204 | GNUNET_break (tp != (time_t) - 1); |
205 | ret.abs_value = tp * 1000LL; /* seconds to ms */ | 205 | ret.abs_value_us = tp * 1000LL * 1000LL; /* seconds to microseconds */ |
206 | return ret; | 206 | return ret; |
207 | } | 207 | } |
208 | 208 | ||
@@ -219,7 +219,7 @@ GNUNET_FS_time_to_year (struct GNUNET_TIME_Absolute at) | |||
219 | struct tm *t; | 219 | struct tm *t; |
220 | time_t tp; | 220 | time_t tp; |
221 | 221 | ||
222 | tp = at.abs_value / 1000; /* ms to seconds */ | 222 | tp = at.abs_value_us / 1000LL / 1000LL; /* microseconds to seconds */ |
223 | t = gmtime (&tp); | 223 | t = gmtime (&tp); |
224 | if (t == NULL) | 224 | if (t == NULL) |
225 | return 0; | 225 | return 0; |
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index 9bc254254..38bd55caa 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c | |||
@@ -342,7 +342,7 @@ GNUNET_FS_search_probe_progress_ (void *cls, | |||
342 | { | 342 | { |
343 | /* should only happen if the cancel task was already | 343 | /* should only happen if the cancel task was already |
344 | created on 'DOWNLOAD_INACTIVE' as we were out of time */ | 344 | created on 'DOWNLOAD_INACTIVE' as we were out of time */ |
345 | GNUNET_break (0 == sr->remaining_probe_time.rel_value); | 345 | GNUNET_break (0 == sr->remaining_probe_time.rel_value_us); |
346 | } | 346 | } |
347 | break; | 347 | break; |
348 | case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE: | 348 | case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE: |
@@ -354,7 +354,7 @@ GNUNET_FS_search_probe_progress_ (void *cls, | |||
354 | dur = GNUNET_TIME_absolute_get_duration (sr->probe_active_time); | 354 | dur = GNUNET_TIME_absolute_get_duration (sr->probe_active_time); |
355 | sr->remaining_probe_time = | 355 | sr->remaining_probe_time = |
356 | GNUNET_TIME_relative_subtract (sr->remaining_probe_time, dur); | 356 | GNUNET_TIME_relative_subtract (sr->remaining_probe_time, dur); |
357 | if (0 == sr->remaining_probe_time.rel_value) | 357 | if (0 == sr->remaining_probe_time.rel_value_us) |
358 | sr->probe_cancel_task = | 358 | sr->probe_cancel_task = |
359 | GNUNET_SCHEDULER_add_now (&probe_failure_handler, sr); | 359 | GNUNET_SCHEDULER_add_now (&probe_failure_handler, sr); |
360 | GNUNET_FS_search_result_sync_ (sr); | 360 | GNUNET_FS_search_result_sync_ (sr); |
@@ -843,7 +843,7 @@ process_result (struct GNUNET_FS_SearchContext *sc, | |||
843 | const void *data, | 843 | const void *data, |
844 | size_t size) | 844 | size_t size) |
845 | { | 845 | { |
846 | if (GNUNET_TIME_absolute_get_duration (expiration).rel_value > 0) | 846 | if (GNUNET_TIME_absolute_get_duration (expiration).rel_value_us > 0) |
847 | { | 847 | { |
848 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 848 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
849 | "Result received has already expired.\n"); | 849 | "Result received has already expired.\n"); |
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c index e0bdc7ed6..6724dc625 100644 --- a/src/fs/fs_uri.c +++ b/src/fs/fs_uri.c | |||
@@ -638,7 +638,7 @@ uri_loc_parse (const char *s, char **emsg) | |||
638 | } | 638 | } |
639 | ass.purpose.size = htonl (sizeof (struct LocUriAssembly)); | 639 | ass.purpose.size = htonl (sizeof (struct LocUriAssembly)); |
640 | ass.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT); | 640 | ass.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT); |
641 | et.abs_value = exptime; | 641 | et.abs_value_us = exptime * 1000LL * 1000LL; |
642 | ass.exptime = GNUNET_TIME_absolute_hton (et); | 642 | ass.exptime = GNUNET_TIME_absolute_hton (et); |
643 | if (GNUNET_OK != | 643 | if (GNUNET_OK != |
644 | GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT, | 644 | GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT, |
@@ -2030,13 +2030,14 @@ uri_loc_to_string (const struct GNUNET_FS_Uri *uri) | |||
2030 | peerSig = | 2030 | peerSig = |
2031 | bin2enc (&uri->data.loc.contentSignature, | 2031 | bin2enc (&uri->data.loc.contentSignature, |
2032 | sizeof (struct GNUNET_CRYPTO_EccSignature)); | 2032 | sizeof (struct GNUNET_CRYPTO_EccSignature)); |
2033 | GNUNET_asprintf (&ret, "%s%s%s.%s.%llu.%s.%s.%llu", GNUNET_FS_URI_PREFIX, | 2033 | GNUNET_asprintf (&ret, |
2034 | "%s%s%s.%s.%llu.%s.%s.%llu", GNUNET_FS_URI_PREFIX, | ||
2034 | GNUNET_FS_URI_LOC_INFIX, (const char *) &keyhash, | 2035 | GNUNET_FS_URI_LOC_INFIX, (const char *) &keyhash, |
2035 | (const char *) &queryhash, | 2036 | (const char *) &queryhash, |
2036 | (unsigned long long) GNUNET_ntohll (uri->data.loc. | 2037 | (unsigned long long) GNUNET_ntohll (uri->data.loc. |
2037 | fi.file_length), peerId, | 2038 | fi.file_length), peerId, |
2038 | peerSig, | 2039 | peerSig, |
2039 | (unsigned long long) uri->data.loc.expirationTime.abs_value); | 2040 | (unsigned long long) uri->data.loc.expirationTime.abs_value_us / 1000LL / 1000LL); |
2040 | GNUNET_free (peerSig); | 2041 | GNUNET_free (peerSig); |
2041 | GNUNET_free (peerId); | 2042 | GNUNET_free (peerId); |
2042 | return ret; | 2043 | return ret; |
diff --git a/src/fs/gnunet-daemon-fsprofiler.c b/src/fs/gnunet-daemon-fsprofiler.c index 16a74b8a0..30a127559 100644 --- a/src/fs/gnunet-daemon-fsprofiler.c +++ b/src/fs/gnunet-daemon-fsprofiler.c | |||
@@ -189,7 +189,7 @@ parse_pattern (struct Pattern **head, | |||
189 | p = GNUNET_malloc (sizeof (struct Pattern)); | 189 | p = GNUNET_malloc (sizeof (struct Pattern)); |
190 | p->x = x; | 190 | p->x = x; |
191 | p->y = y; | 191 | p->y = y; |
192 | p->delay.rel_value = (uint64_t) t; | 192 | p->delay.rel_value_us = (uint64_t) t; |
193 | GNUNET_CONTAINER_DLL_insert (*head, *tail, p); | 193 | GNUNET_CONTAINER_DLL_insert (*head, *tail, p); |
194 | pattern = strstr (pattern, ")"); | 194 | pattern = strstr (pattern, ")"); |
195 | GNUNET_assert (NULL != pattern); | 195 | GNUNET_assert (NULL != pattern); |
@@ -397,7 +397,7 @@ progress_cb (void *cls, | |||
397 | p = info->value.publish.cctx; | 397 | p = info->value.publish.cctx; |
398 | GNUNET_STATISTICS_update (stats_handle, | 398 | GNUNET_STATISTICS_update (stats_handle, |
399 | "# publishing time (ms)", | 399 | "# publishing time (ms)", |
400 | (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value, | 400 | (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, |
401 | GNUNET_NO); | 401 | GNUNET_NO); |
402 | p->task = GNUNET_SCHEDULER_add_now (&publish_stop_task, p); | 402 | p->task = GNUNET_SCHEDULER_add_now (&publish_stop_task, p); |
403 | return p; | 403 | return p; |
@@ -425,8 +425,9 @@ progress_cb (void *cls, | |||
425 | p = info->value.download.cctx; | 425 | p = info->value.download.cctx; |
426 | GNUNET_STATISTICS_update (stats_handle, | 426 | GNUNET_STATISTICS_update (stats_handle, |
427 | "# download time (ms)", | 427 | "# download time (ms)", |
428 | (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value, | 428 | (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, |
429 | GNUNET_NO); p->task = GNUNET_SCHEDULER_add_now (&download_stop_task, p); | 429 | GNUNET_NO); |
430 | p->task = GNUNET_SCHEDULER_add_now (&download_stop_task, p); | ||
430 | return p; | 431 | return p; |
431 | case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: | 432 | case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: |
432 | p = info->value.download.cctx; | 433 | p = info->value.download.cctx; |
@@ -450,7 +451,7 @@ progress_cb (void *cls, | |||
450 | return NULL; /* not what we want */ | 451 | return NULL; /* not what we want */ |
451 | GNUNET_STATISTICS_update (stats_handle, | 452 | GNUNET_STATISTICS_update (stats_handle, |
452 | "# search time (ms)", | 453 | "# search time (ms)", |
453 | (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value, | 454 | (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, |
454 | GNUNET_NO); | 455 | GNUNET_NO); |
455 | p->start_time = GNUNET_TIME_absolute_get (); | 456 | p->start_time = GNUNET_TIME_absolute_get (); |
456 | p->ctx = GNUNET_FS_download_start (fs_handle, uri, | 457 | p->ctx = GNUNET_FS_download_start (fs_handle, uri, |
diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c index 04edc66c8..30081f0b4 100644 --- a/src/fs/gnunet-download.c +++ b/src/fs/gnunet-download.c | |||
@@ -142,8 +142,8 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | |||
142 | { | 142 | { |
143 | s = GNUNET_strdup (GNUNET_STRINGS_relative_time_to_string (info->value.download.eta, | 143 | s = GNUNET_strdup (GNUNET_STRINGS_relative_time_to_string (info->value.download.eta, |
144 | GNUNET_YES)); | 144 | GNUNET_YES)); |
145 | if (info->value.download.specifics.progress.block_download_duration.rel_value | 145 | if (info->value.download.specifics.progress.block_download_duration.rel_value_us |
146 | == GNUNET_TIME_UNIT_FOREVER_REL.rel_value) | 146 | == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) |
147 | s2 = _("<unknown time>"); | 147 | s2 = _("<unknown time>"); |
148 | else | 148 | else |
149 | s2 = GNUNET_STRINGS_relative_time_to_string ( | 149 | s2 = GNUNET_STRINGS_relative_time_to_string ( |
@@ -152,7 +152,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | |||
152 | t = GNUNET_STRINGS_byte_size_fancy (info->value.download.completed * | 152 | t = GNUNET_STRINGS_byte_size_fancy (info->value.download.completed * |
153 | 1000LL / | 153 | 1000LL / |
154 | (info->value.download. | 154 | (info->value.download. |
155 | duration.rel_value + 1)); | 155 | duration.rel_value_us + 1)); |
156 | FPRINTF (stdout, | 156 | FPRINTF (stdout, |
157 | _("Downloading `%s' at %llu/%llu (%s remaining, %s/s). Block took %s to download\n"), | 157 | _("Downloading `%s' at %llu/%llu (%s remaining, %s/s). Block took %s to download\n"), |
158 | info->value.download.filename, | 158 | info->value.download.filename, |
@@ -183,7 +183,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | |||
183 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: | 183 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: |
184 | s = GNUNET_STRINGS_byte_size_fancy (info->value.download.completed * 1000 / | 184 | s = GNUNET_STRINGS_byte_size_fancy (info->value.download.completed * 1000 / |
185 | (info->value.download. | 185 | (info->value.download. |
186 | duration.rel_value + 1)); | 186 | duration.rel_value_us + 1)); |
187 | #if !WINDOWS | 187 | #if !WINDOWS |
188 | if (0 != isatty (1)) | 188 | if (0 != isatty (1)) |
189 | fprintf (stdout, "\n"); | 189 | fprintf (stdout, "\n"); |
diff --git a/src/fs/gnunet-fs-profiler.c b/src/fs/gnunet-fs-profiler.c index 9bc3ff253..cde70ae88 100644 --- a/src/fs/gnunet-fs-profiler.c +++ b/src/fs/gnunet-fs-profiler.c | |||
@@ -145,7 +145,7 @@ test_master (void *cls, unsigned int num_peers, | |||
145 | // FIXME: enable clients to signal 'completion' before timeout; | 145 | // FIXME: enable clients to signal 'completion' before timeout; |
146 | // in that case, run the 'terminate_task' "immediately" | 146 | // in that case, run the 'terminate_task' "immediately" |
147 | 147 | ||
148 | if (0 != timeout.rel_value) | 148 | if (0 != timeout.rel_value_us) |
149 | terminate_taskid = GNUNET_SCHEDULER_add_delayed (timeout, | 149 | terminate_taskid = GNUNET_SCHEDULER_add_delayed (timeout, |
150 | &terminate_task, NULL); | 150 | &terminate_task, NULL); |
151 | else | 151 | else |
diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c index e90b761d7..df544c21b 100644 --- a/src/fs/gnunet-search.c +++ b/src/fs/gnunet-search.c | |||
@@ -259,7 +259,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
259 | ret = 1; | 259 | ret = 1; |
260 | return; | 260 | return; |
261 | } | 261 | } |
262 | if (0 != timeout.rel_value) | 262 | if (0 != timeout.rel_value_us) |
263 | GNUNET_SCHEDULER_add_delayed (timeout, &shutdown_task, NULL); | 263 | GNUNET_SCHEDULER_add_delayed (timeout, &shutdown_task, NULL); |
264 | else | 264 | else |
265 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, | 265 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, |
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 9074f053e..a8fbda84b 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -202,7 +202,7 @@ GSF_update_datastore_delay_ (struct GNUNET_TIME_Absolute start) | |||
202 | struct GNUNET_TIME_Relative delay; | 202 | struct GNUNET_TIME_Relative delay; |
203 | 203 | ||
204 | delay = GNUNET_TIME_absolute_get_duration (start); | 204 | delay = GNUNET_TIME_absolute_get_duration (start); |
205 | GNUNET_LOAD_update (datastore_get_load, delay.rel_value); | 205 | GNUNET_LOAD_update (datastore_get_load, delay.rel_value_us); |
206 | } | 206 | } |
207 | 207 | ||
208 | 208 | ||
@@ -260,16 +260,16 @@ update_latencies (void *cls, | |||
260 | { | 260 | { |
261 | if (GNUNET_ATS_QUALITY_NET_DELAY != ntohl (ats[i].type)) | 261 | if (GNUNET_ATS_QUALITY_NET_DELAY != ntohl (ats[i].type)) |
262 | continue; | 262 | continue; |
263 | latency.rel_value = ntohl (ats[i].value); | 263 | latency.rel_value_us = ntohl (ats[i].value); |
264 | GSF_update_peer_latency_ (&address->peer, | 264 | GSF_update_peer_latency_ (&address->peer, |
265 | latency); | 265 | latency); |
266 | GSF_avg_latency.rel_value = | 266 | GSF_avg_latency.rel_value_us = |
267 | (GSF_avg_latency.rel_value * 31 + | 267 | (GSF_avg_latency.rel_value_us * 31 + |
268 | GNUNET_MIN (5000, ntohl (ats[i].value))) / 32; | 268 | GNUNET_MIN (5000, ntohl (ats[i].value))) / 32; |
269 | GNUNET_STATISTICS_set (GSF_stats, | 269 | GNUNET_STATISTICS_set (GSF_stats, |
270 | gettext_noop | 270 | gettext_noop |
271 | ("# running average P2P latency (ms)"), | 271 | ("# running average P2P latency (ms)"), |
272 | GSF_avg_latency.rel_value, GNUNET_NO); | 272 | GSF_avg_latency.rel_value_us / 1000LL, GNUNET_NO); |
273 | break; | 273 | break; |
274 | } | 274 | } |
275 | } | 275 | } |
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index e1a3e1ac9..5f047665e 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c | |||
@@ -488,7 +488,7 @@ peer_transmit_ready_cb (void *cls, size_t size, void *buf) | |||
488 | } | 488 | } |
489 | GNUNET_LOAD_update (cp->ppd.transmission_delay, | 489 | GNUNET_LOAD_update (cp->ppd.transmission_delay, |
490 | GNUNET_TIME_absolute_get_duration | 490 | GNUNET_TIME_absolute_get_duration |
491 | (pth->transmission_request_start_time).rel_value); | 491 | (pth->transmission_request_start_time).rel_value_us); |
492 | ret = pth->gmc (pth->gmc_cls, size, buf); | 492 | ret = pth->gmc (pth->gmc_cls, size, buf); |
493 | if (NULL != (pos = cp->pth_head)) | 493 | if (NULL != (pos = cp->pth_head)) |
494 | { | 494 | { |
@@ -621,7 +621,7 @@ revive_migration (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
621 | 621 | ||
622 | cp->mig_revive_task = GNUNET_SCHEDULER_NO_TASK; | 622 | cp->mig_revive_task = GNUNET_SCHEDULER_NO_TASK; |
623 | bt = GNUNET_TIME_absolute_get_remaining (cp->ppd.migration_blocked_until); | 623 | bt = GNUNET_TIME_absolute_get_remaining (cp->ppd.migration_blocked_until); |
624 | if (0 != bt.rel_value) | 624 | if (0 != bt.rel_value_us) |
625 | { | 625 | { |
626 | /* still time left... */ | 626 | /* still time left... */ |
627 | cp->mig_revive_task = | 627 | cp->mig_revive_task = |
@@ -833,12 +833,12 @@ get_randomized_delay () | |||
833 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, | 833 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, |
834 | GNUNET_CRYPTO_random_u32 | 834 | GNUNET_CRYPTO_random_u32 |
835 | (GNUNET_CRYPTO_QUALITY_WEAK, | 835 | (GNUNET_CRYPTO_QUALITY_WEAK, |
836 | 2 * GSF_avg_latency.rel_value + 1)); | 836 | 2 * GSF_avg_latency.rel_value_us + 1)); |
837 | #if INSANE_STATISTICS | 837 | #if INSANE_STATISTICS |
838 | GNUNET_STATISTICS_update (GSF_stats, | 838 | GNUNET_STATISTICS_update (GSF_stats, |
839 | gettext_noop | 839 | gettext_noop |
840 | ("# artificial delays introduced (ms)"), | 840 | ("# artificial delays introduced (ms)"), |
841 | ret.rel_value, GNUNET_NO); | 841 | ret.rel_value_us / 1000LL, GNUNET_NO); |
842 | #endif | 842 | #endif |
843 | return ret; | 843 | return ret; |
844 | } | 844 | } |
@@ -1216,7 +1216,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, | |||
1216 | spid = 0; | 1216 | spid = 0; |
1217 | if ((GNUNET_LOAD_get_load (cp->ppd.transmission_delay) > 3 * (1 + priority)) | 1217 | if ((GNUNET_LOAD_get_load (cp->ppd.transmission_delay) > 3 * (1 + priority)) |
1218 | || (GNUNET_LOAD_get_average (cp->ppd.transmission_delay) > | 1218 | || (GNUNET_LOAD_get_average (cp->ppd.transmission_delay) > |
1219 | GNUNET_CONSTANTS_MAX_CORK_DELAY.rel_value * 2 + | 1219 | GNUNET_CONSTANTS_MAX_CORK_DELAY.rel_value_us * 2 + |
1220 | GNUNET_LOAD_get_average (GSF_rt_entry_lifetime))) | 1220 | GNUNET_LOAD_get_average (GSF_rt_entry_lifetime))) |
1221 | { | 1221 | { |
1222 | /* don't have BW to send to peer, or would likely take longer than we have for it, | 1222 | /* don't have BW to send to peer, or would likely take longer than we have for it, |
@@ -1253,7 +1253,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, | |||
1253 | prd = GSF_pending_request_get_data_ (pr); | 1253 | prd = GSF_pending_request_get_data_ (pr); |
1254 | if (prd->type == type) | 1254 | if (prd->type == type) |
1255 | { | 1255 | { |
1256 | if (prd->ttl.abs_value >= GNUNET_TIME_absolute_get ().abs_value + ttl) | 1256 | if (prd->ttl.abs_value_us >= GNUNET_TIME_absolute_get ().abs_value_us + ttl * 1000LL) |
1257 | { | 1257 | { |
1258 | /* existing request has higher TTL, drop new one! */ | 1258 | /* existing request has higher TTL, drop new one! */ |
1259 | prd->priority += priority; | 1259 | prd->priority += priority; |
@@ -1425,9 +1425,9 @@ GSF_peer_update_performance_ (struct GSF_ConnectedPeer *cp, | |||
1425 | struct GNUNET_TIME_Relative delay; | 1425 | struct GNUNET_TIME_Relative delay; |
1426 | 1426 | ||
1427 | delay = GNUNET_TIME_absolute_get_duration (request_time); | 1427 | delay = GNUNET_TIME_absolute_get_duration (request_time); |
1428 | cp->ppd.avg_reply_delay.rel_value = | 1428 | cp->ppd.avg_reply_delay.rel_value_us = |
1429 | (cp->ppd.avg_reply_delay.rel_value * (RUNAVG_DELAY_N - 1) + | 1429 | (cp->ppd.avg_reply_delay.rel_value_us * (RUNAVG_DELAY_N - 1) + |
1430 | delay.rel_value) / RUNAVG_DELAY_N; | 1430 | delay.rel_value_us) / RUNAVG_DELAY_N; |
1431 | cp->ppd.avg_priority = | 1431 | cp->ppd.avg_priority = |
1432 | (cp->ppd.avg_priority * (RUNAVG_DELAY_N - 1) + | 1432 | (cp->ppd.avg_priority * (RUNAVG_DELAY_N - 1) + |
1433 | request_priority) / RUNAVG_DELAY_N; | 1433 | request_priority) / RUNAVG_DELAY_N; |
@@ -1678,7 +1678,7 @@ void | |||
1678 | GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp, | 1678 | GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp, |
1679 | struct GNUNET_TIME_Absolute block_time) | 1679 | struct GNUNET_TIME_Absolute block_time) |
1680 | { | 1680 | { |
1681 | if (cp->last_migration_block.abs_value > block_time.abs_value) | 1681 | if (cp->last_migration_block.abs_value_us > block_time.abs_value_us) |
1682 | { | 1682 | { |
1683 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1683 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1684 | "Migration already blocked for another %s\n", | 1684 | "Migration already blocked for another %s\n", |
@@ -1686,8 +1686,9 @@ GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp, | |||
1686 | (cp->last_migration_block), GNUNET_YES)); | 1686 | (cp->last_migration_block), GNUNET_YES)); |
1687 | return; /* already blocked */ | 1687 | return; /* already blocked */ |
1688 | } | 1688 | } |
1689 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking to stop migration for %llu ms\n", | 1689 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking to stop migration for %s\n", |
1690 | (unsigned long long) GNUNET_TIME_absolute_get_remaining (block_time).rel_value); | 1690 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (block_time), |
1691 | GNUNET_YES)); | ||
1691 | cp->last_migration_block = block_time; | 1692 | cp->last_migration_block = block_time; |
1692 | if (NULL != cp->migration_pth) | 1693 | if (NULL != cp->migration_pth) |
1693 | GSF_peer_transmit_cancel_ (cp->migration_pth); | 1694 | GSF_peer_transmit_cancel_ (cp->migration_pth); |
diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c index 5c63e7b66..21f028a2d 100644 --- a/src/fs/gnunet-service-fs_pe.c +++ b/src/fs/gnunet-service-fs_pe.c | |||
@@ -283,11 +283,11 @@ plan (struct PeerPlan *pp, struct GSF_RequestPlan *rp) | |||
283 | delay = | 283 | delay = |
284 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, | 284 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, |
285 | 8 + (1LL << 24)); | 285 | 8 + (1LL << 24)); |
286 | delay.rel_value = | 286 | delay.rel_value_us = |
287 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 287 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
288 | delay.rel_value + 1); | 288 | delay.rel_value_us + 1); |
289 | /* Add 0.01 to avg_delay to avoid division-by-zero later */ | 289 | /* Add 0.01 to avg_delay to avoid division-by-zero later */ |
290 | avg_delay = (((avg_delay * (N - 1.0)) + delay.rel_value) / N) + 0.01; | 290 | avg_delay = (((avg_delay * (N - 1.0)) + delay.rel_value_us) / N) + 0.01; |
291 | 291 | ||
292 | /* | 292 | /* |
293 | * For the priority, we need to consider a few basic rules: | 293 | * For the priority, we need to consider a few basic rules: |
@@ -312,27 +312,27 @@ plan (struct PeerPlan *pp, struct GSF_RequestPlan *rp) | |||
312 | */ | 312 | */ |
313 | rp->priority = | 313 | rp->priority = |
314 | round ((GSF_current_priorities + | 314 | round ((GSF_current_priorities + |
315 | 1.0) * atan (delay.rel_value / avg_delay)) / M_PI_4; | 315 | 1.0) * atan (delay.rel_value_us / avg_delay)) / M_PI_4; |
316 | /* Note: usage of 'round' and 'atan' requires -lm */ | 316 | /* Note: usage of 'round' and 'atan' requires -lm */ |
317 | 317 | ||
318 | if (rp->transmission_counter != 0) | 318 | if (rp->transmission_counter != 0) |
319 | delay.rel_value += TTL_DECREMENT; | 319 | delay.rel_value_us += TTL_DECREMENT * 1000; |
320 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 320 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
321 | "Considering (re)transmission number %u in %llu ms\n", | 321 | "Considering (re)transmission number %u in %s\n", |
322 | (unsigned int) rp->transmission_counter, | 322 | (unsigned int) rp->transmission_counter, |
323 | (unsigned long long) delay.rel_value); | 323 | GNUNET_STRINGS_relative_time_to_string (delay, |
324 | GNUNET_YES)); | ||
324 | rp->earliest_transmission = GNUNET_TIME_relative_to_absolute (delay); | 325 | rp->earliest_transmission = GNUNET_TIME_relative_to_absolute (delay); |
325 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 326 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
326 | "Earliest (re)transmission for `%s' in %us\n", | 327 | "Earliest (re)transmission for `%s' in %us\n", |
327 | GNUNET_h2s (&prd->query), rp->transmission_counter); | 328 | GNUNET_h2s (&prd->query), rp->transmission_counter); |
328 | GNUNET_assert (rp->hn == NULL); | 329 | GNUNET_assert (rp->hn == NULL); |
329 | if (GNUNET_TIME_absolute_get_remaining (rp->earliest_transmission).rel_value | 330 | if (0 == GNUNET_TIME_absolute_get_remaining (rp->earliest_transmission).rel_value_us) |
330 | == 0) | ||
331 | rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap, rp, rp->priority); | 331 | rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap, rp, rp->priority); |
332 | else | 332 | else |
333 | rp->hn = | 333 | rp->hn = |
334 | GNUNET_CONTAINER_heap_insert (pp->delay_heap, rp, | 334 | GNUNET_CONTAINER_heap_insert (pp->delay_heap, rp, |
335 | rp->earliest_transmission.abs_value); | 335 | rp->earliest_transmission.abs_value_us); |
336 | GNUNET_assert (GNUNET_YES == | 336 | GNUNET_assert (GNUNET_YES == |
337 | GNUNET_CONTAINER_multihashmap_contains_value (pp->plan_map, | 337 | GNUNET_CONTAINER_multihashmap_contains_value (pp->plan_map, |
338 | get_rp_key (rp), | 338 | get_rp_key (rp), |
@@ -363,8 +363,8 @@ get_latest (const struct GSF_RequestPlan *rp) | |||
363 | bi = bi->next_PE; | 363 | bi = bi->next_PE; |
364 | while (NULL != bi) | 364 | while (NULL != bi) |
365 | { | 365 | { |
366 | if (GSF_pending_request_get_data_ (bi->pr)->ttl.abs_value > | 366 | if (GSF_pending_request_get_data_ (bi->pr)->ttl.abs_value_us > |
367 | GSF_pending_request_get_data_ (ret)->ttl.abs_value) | 367 | GSF_pending_request_get_data_ (ret)->ttl.abs_value_us) |
368 | ret = bi->pr; | 368 | ret = bi->pr; |
369 | bi = bi->next_PE; | 369 | bi = bi->next_PE; |
370 | } | 370 | } |
@@ -459,8 +459,8 @@ schedule_peer_transmission (void *cls, | |||
459 | } | 459 | } |
460 | /* move ready requests to priority queue */ | 460 | /* move ready requests to priority queue */ |
461 | while ((NULL != (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap))) && | 461 | while ((NULL != (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap))) && |
462 | (GNUNET_TIME_absolute_get_remaining | 462 | (0 == GNUNET_TIME_absolute_get_remaining |
463 | (rp->earliest_transmission).rel_value == 0)) | 463 | (rp->earliest_transmission).rel_value_us)) |
464 | { | 464 | { |
465 | GNUNET_assert (rp == GNUNET_CONTAINER_heap_remove_root (pp->delay_heap)); | 465 | GNUNET_assert (rp == GNUNET_CONTAINER_heap_remove_root (pp->delay_heap)); |
466 | rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap, rp, rp->priority); | 466 | rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap, rp, rp->priority); |
@@ -477,10 +477,12 @@ schedule_peer_transmission (void *cls, | |||
477 | } | 477 | } |
478 | delay = GNUNET_TIME_absolute_get_remaining (rp->earliest_transmission); | 478 | delay = GNUNET_TIME_absolute_get_remaining (rp->earliest_transmission); |
479 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 479 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
480 | "Sleeping for %llu ms before retrying requests on plan %p.\n", | 480 | "Sleeping for %s before retrying requests on plan %p.\n", |
481 | (unsigned long long) delay.rel_value, pp); | 481 | GNUNET_STRINGS_relative_time_to_string (delay, |
482 | GNUNET_STATISTICS_set (GSF_stats, gettext_noop ("# delay heap timeout"), | 482 | GNUNET_YES), |
483 | delay.rel_value, GNUNET_NO); | 483 | pp); |
484 | GNUNET_STATISTICS_set (GSF_stats, gettext_noop ("# delay heap timeout (ms)"), | ||
485 | delay.rel_value_us / 1000LL, GNUNET_NO); | ||
484 | 486 | ||
485 | pp->task = | 487 | pp->task = |
486 | GNUNET_SCHEDULER_add_delayed (delay, &schedule_peer_transmission, pp); | 488 | GNUNET_SCHEDULER_add_delayed (delay, &schedule_peer_transmission, pp); |
@@ -551,8 +553,8 @@ merge_pr (void *cls, const struct GNUNET_HashCode * query, void *element) | |||
551 | GNUNET_NO); | 553 | GNUNET_NO); |
552 | #endif | 554 | #endif |
553 | latest = get_latest (rp); | 555 | latest = get_latest (rp); |
554 | if (GSF_pending_request_get_data_ (latest)->ttl.abs_value < | 556 | if (GSF_pending_request_get_data_ (latest)->ttl.abs_value_us < |
555 | prd->ttl.abs_value) | 557 | prd->ttl.abs_value_us) |
556 | { | 558 | { |
557 | #if INSANE_STATISTICS | 559 | #if INSANE_STATISTICS |
558 | GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# requests refreshed"), | 560 | GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# requests refreshed"), |
@@ -721,7 +723,7 @@ GSF_request_plan_reference_get_last_transmission_ ( | |||
721 | { | 723 | { |
722 | if (bi->rp->pp->cp == sender) | 724 | if (bi->rp->pp->cp == sender) |
723 | { | 725 | { |
724 | if (0 == bi->rp->last_transmission.abs_value) | 726 | if (0 == bi->rp->last_transmission.abs_value_us) |
725 | *result = GNUNET_TIME_UNIT_FOREVER_ABS; | 727 | *result = GNUNET_TIME_UNIT_FOREVER_ABS; |
726 | else | 728 | else |
727 | *result = bi->rp->last_transmission; | 729 | *result = bi->rp->last_transmission; |
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index a78cbf287..627d376ef 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009, 2010, 2011, 2012 Christian Grothoff (and other contributing authors) | 3 | (C) 2009-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -373,7 +373,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, | |||
373 | { | 373 | { |
374 | pr->hnode = | 374 | pr->hnode = |
375 | GNUNET_CONTAINER_heap_insert (requests_by_expiration_heap, pr, | 375 | GNUNET_CONTAINER_heap_insert (requests_by_expiration_heap, pr, |
376 | pr->public_data.ttl.abs_value); | 376 | pr->public_data.ttl.abs_value_us); |
377 | /* make sure we don't track too many requests */ | 377 | /* make sure we don't track too many requests */ |
378 | while (GNUNET_CONTAINER_heap_get_size (requests_by_expiration_heap) > | 378 | while (GNUNET_CONTAINER_heap_get_size (requests_by_expiration_heap) > |
379 | max_pending_requests) | 379 | max_pending_requests) |
@@ -555,8 +555,8 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr, | |||
555 | pr->public_data.respect_offered += prio; | 555 | pr->public_data.respect_offered += prio; |
556 | gm->priority = htonl (prio); | 556 | gm->priority = htonl (prio); |
557 | now = GNUNET_TIME_absolute_get (); | 557 | now = GNUNET_TIME_absolute_get (); |
558 | ttl = (int64_t) (pr->public_data.ttl.abs_value - now.abs_value); | 558 | ttl = (int64_t) (pr->public_data.ttl.abs_value_us - now.abs_value_us); |
559 | gm->ttl = htonl (ttl / 1000); | 559 | gm->ttl = htonl (ttl / 1000LL / 1000LL); |
560 | gm->filter_mutator = htonl (pr->mingle); | 560 | gm->filter_mutator = htonl (pr->mingle); |
561 | gm->hash_bitmap = htonl (bm); | 561 | gm->hash_bitmap = htonl (bm); |
562 | gm->query = pr->public_data.query; | 562 | gm->query = pr->public_data.query; |
@@ -825,12 +825,12 @@ process_reply (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
825 | update_request_performance_data (prq, pr); | 825 | update_request_performance_data (prq, pr); |
826 | GNUNET_LOAD_update (GSF_rt_entry_lifetime, | 826 | GNUNET_LOAD_update (GSF_rt_entry_lifetime, |
827 | GNUNET_TIME_absolute_get_duration (pr-> | 827 | GNUNET_TIME_absolute_get_duration (pr-> |
828 | public_data.start_time).rel_value); | 828 | public_data.start_time).rel_value_us); |
829 | if (GNUNET_YES != | 829 | if (GNUNET_YES != |
830 | GSF_request_plan_reference_get_last_transmission_ (pr->public_data.pr_head, | 830 | GSF_request_plan_reference_get_last_transmission_ (pr->public_data.pr_head, |
831 | prq->sender, | 831 | prq->sender, |
832 | &last_transmission)) | 832 | &last_transmission)) |
833 | last_transmission.abs_value = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value; | 833 | last_transmission.abs_value_us = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; |
834 | /* pass on to other peers / local clients */ | 834 | /* pass on to other peers / local clients */ |
835 | pr->rh (pr->rh_cls, prq->eval, pr, prq->anonymity_level, prq->expiration, | 835 | pr->rh (pr->rh_cls, prq->eval, pr, prq->anonymity_level, prq->expiration, |
836 | last_transmission, prq->type, prq->data, prq->size); | 836 | last_transmission, prq->type, prq->data, prq->size); |
@@ -891,7 +891,7 @@ process_reply (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
891 | if (! GSF_request_plan_reference_get_last_transmission_ (pr->public_data.pr_head, | 891 | if (! GSF_request_plan_reference_get_last_transmission_ (pr->public_data.pr_head, |
892 | prq->sender, | 892 | prq->sender, |
893 | &last_transmission)) | 893 | &last_transmission)) |
894 | last_transmission.abs_value = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value; | 894 | last_transmission.abs_value_us = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; |
895 | pr->rh (pr->rh_cls, prq->eval, pr, | 895 | pr->rh (pr->rh_cls, prq->eval, pr, |
896 | prq->anonymity_level, prq->expiration, | 896 | prq->anonymity_level, prq->expiration, |
897 | last_transmission, prq->type, prq->data, prq->size); | 897 | last_transmission, prq->type, prq->data, prq->size); |
@@ -947,13 +947,13 @@ put_migration_continuation (void *cls, int success, | |||
947 | if (GNUNET_SYSERR != success) | 947 | if (GNUNET_SYSERR != success) |
948 | { | 948 | { |
949 | GNUNET_LOAD_update (datastore_put_load, | 949 | GNUNET_LOAD_update (datastore_put_load, |
950 | GNUNET_TIME_absolute_get_duration (pmc->start).rel_value); | 950 | GNUNET_TIME_absolute_get_duration (pmc->start).rel_value_us); |
951 | } | 951 | } |
952 | else | 952 | else |
953 | { | 953 | { |
954 | /* on queue failure / timeout, increase the put load dramatically */ | 954 | /* on queue failure / timeout, increase the put load dramatically */ |
955 | GNUNET_LOAD_update (datastore_put_load, | 955 | GNUNET_LOAD_update (datastore_put_load, |
956 | GNUNET_TIME_UNIT_MINUTES.rel_value); | 956 | GNUNET_TIME_UNIT_MINUTES.rel_value_us); |
957 | } | 957 | } |
958 | } | 958 | } |
959 | cp = GSF_peer_get_ (&pmc->origin); | 959 | cp = GSF_peer_get_ (&pmc->origin); |
@@ -962,7 +962,7 @@ put_migration_continuation (void *cls, int success, | |||
962 | if (NULL != cp) | 962 | if (NULL != cp) |
963 | { | 963 | { |
964 | ppd = GSF_get_peer_performance_data_ (cp); | 964 | ppd = GSF_get_peer_performance_data_ (cp); |
965 | ppd->migration_delay.rel_value /= 2; | 965 | ppd->migration_delay.rel_value_us /= 2; |
966 | } | 966 | } |
967 | GNUNET_free (pmc); | 967 | GNUNET_free (pmc); |
968 | return; | 968 | return; |
@@ -972,7 +972,7 @@ put_migration_continuation (void *cls, int success, | |||
972 | (NULL != cp) ) | 972 | (NULL != cp) ) |
973 | { | 973 | { |
974 | ppd = GSF_get_peer_performance_data_ (cp); | 974 | ppd = GSF_get_peer_performance_data_ (cp); |
975 | if (min_expiration.abs_value > 0) | 975 | if (min_expiration.abs_value_us > 0) |
976 | { | 976 | { |
977 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 977 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
978 | "Asking to stop migration for %s because datastore is full\n", | 978 | "Asking to stop migration for %s because datastore is full\n", |
@@ -985,8 +985,8 @@ put_migration_continuation (void *cls, int success, | |||
985 | ppd->migration_delay); | 985 | ppd->migration_delay); |
986 | ppd->migration_delay = GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_HOURS, | 986 | ppd->migration_delay = GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_HOURS, |
987 | ppd->migration_delay); | 987 | ppd->migration_delay); |
988 | mig_pause.rel_value = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | 988 | mig_pause.rel_value_us = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, |
989 | ppd->migration_delay.rel_value); | 989 | ppd->migration_delay.rel_value_us); |
990 | ppd->migration_delay = GNUNET_TIME_relative_multiply (ppd->migration_delay, 2); | 990 | ppd->migration_delay = GNUNET_TIME_relative_multiply (ppd->migration_delay, 2); |
991 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 991 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
992 | "Replicated content already exists locally, asking to stop migration for %s\n", | 992 | "Replicated content already exists locally, asking to stop migration for %s\n", |
@@ -1711,8 +1711,9 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, | |||
1711 | (GNUNET_CRYPTO_QUALITY_WEAK, | 1711 | (GNUNET_CRYPTO_QUALITY_WEAK, |
1712 | (unsigned int) (60000 * putl * putl))); | 1712 | (unsigned int) (60000 * putl * putl))); |
1713 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1713 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1714 | "Asking to stop migration for %llu ms because of load %f and events %d/%d\n", | 1714 | "Asking to stop migration for %s because of load %f and events %d/%d\n", |
1715 | (unsigned long long) block_time.rel_value, | 1715 | GNUNET_STRINGS_relative_time_to_string (block_time, |
1716 | GNUNET_YES), | ||
1716 | putl, | 1717 | putl, |
1717 | active_to_migration, | 1718 | active_to_migration, |
1718 | (GNUNET_NO == prq.request_found)); | 1719 | (GNUNET_NO == prq.request_found)); |
diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c index e7fbbdcaf..70c13f49f 100644 --- a/src/fs/gnunet-service-fs_push.c +++ b/src/fs/gnunet-service-fs_push.c | |||
@@ -482,8 +482,8 @@ process_migration_content (void *cls, const struct GNUNET_HashCode * key, size_t | |||
482 | consider_gathering (); | 482 | consider_gathering (); |
483 | return; | 483 | return; |
484 | } | 484 | } |
485 | if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value < | 485 | if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us < |
486 | MIN_MIGRATION_CONTENT_LIFETIME.rel_value) | 486 | MIN_MIGRATION_CONTENT_LIFETIME.rel_value_us) |
487 | { | 487 | { |
488 | /* content will expire soon, don't bother */ | 488 | /* content will expire soon, don't bother */ |
489 | consider_gathering (); | 489 | consider_gathering (); |
diff --git a/src/fs/perf_gnunet_service_fs_p2p.c b/src/fs/perf_gnunet_service_fs_p2p.c index 3a6b9fd03..b4b71be4e 100644 --- a/src/fs/perf_gnunet_service_fs_p2p.c +++ b/src/fs/perf_gnunet_service_fs_p2p.c | |||
@@ -254,11 +254,11 @@ do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
254 | } | 254 | } |
255 | 255 | ||
256 | del = GNUNET_TIME_absolute_get_duration (start_time); | 256 | del = GNUNET_TIME_absolute_get_duration (start_time); |
257 | if (del.rel_value == 0) | 257 | if (del.rel_value_us == 0) |
258 | del.rel_value = 1; | 258 | del.rel_value_us = 1; |
259 | fancy = | 259 | fancy = |
260 | GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) * | 260 | GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) * |
261 | 1000LL / del.rel_value); | 261 | 1000000LL / del.rel_value_us); |
262 | FPRINTF (stdout, "Download speed was %s/s\n", fancy); | 262 | FPRINTF (stdout, "Download speed was %s/s\n", fancy); |
263 | GNUNET_free (fancy); | 263 | GNUNET_free (fancy); |
264 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished download, shutting down\n", | 264 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished download, shutting down\n", |
diff --git a/src/fs/perf_gnunet_service_fs_p2p_respect.c b/src/fs/perf_gnunet_service_fs_p2p_respect.c index 35425a253..c5846c8c3 100644 --- a/src/fs/perf_gnunet_service_fs_p2p_respect.c +++ b/src/fs/perf_gnunet_service_fs_p2p_respect.c | |||
@@ -297,11 +297,11 @@ do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
297 | return; | 297 | return; |
298 | } | 298 | } |
299 | del = GNUNET_TIME_absolute_get_duration (start_time); | 299 | del = GNUNET_TIME_absolute_get_duration (start_time); |
300 | if (del.rel_value == 0) | 300 | if (del.rel_value_us == 0) |
301 | del.rel_value = 1; | 301 | del.rel_value_us = 1; |
302 | fancy = | 302 | fancy = |
303 | GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) * | 303 | GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) * |
304 | 1000LL / del.rel_value); | 304 | 1000000LL / del.rel_value_us); |
305 | FPRINTF (stderr, "Download speed of type `%s' was %s/s\n", type, fancy); | 305 | FPRINTF (stderr, "Download speed of type `%s' was %s/s\n", type, fancy); |
306 | GNUNET_free (fancy); | 306 | GNUNET_free (fancy); |
307 | if (NUM_DAEMONS != ++download_counter) | 307 | if (NUM_DAEMONS != ++download_counter) |
diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c index 519923450..c069875cf 100644 --- a/src/fs/test_fs_download.c +++ b/src/fs/test_fs_download.c | |||
@@ -142,18 +142,18 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | |||
142 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: | 142 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: |
143 | fprintf (stdout, | 143 | fprintf (stdout, |
144 | "Publishing complete, %llu kb/s.\n", | 144 | "Publishing complete, %llu kb/s.\n", |
145 | (unsigned long long) (FILESIZE * 1000LL / | 145 | (unsigned long long) (FILESIZE * 1000000LL / |
146 | (1 + | 146 | (1 + |
147 | GNUNET_TIME_absolute_get_duration | 147 | GNUNET_TIME_absolute_get_duration |
148 | (start).rel_value) / 1024LL)); | 148 | (start).rel_value_us) / 1024LL)); |
149 | GAUGER ("FS", | 149 | GAUGER ("FS", |
150 | (GNUNET_YES == indexed) | 150 | (GNUNET_YES == indexed) |
151 | ? "Publishing speed (indexing)" | 151 | ? "Publishing speed (indexing)" |
152 | : "Publishing speed (insertion)", | 152 | : "Publishing speed (insertion)", |
153 | (unsigned long long) (FILESIZE * 1000LL / | 153 | (unsigned long long) (FILESIZE * 1000000LL / |
154 | (1 + | 154 | (1 + |
155 | GNUNET_TIME_absolute_get_duration | 155 | GNUNET_TIME_absolute_get_duration |
156 | (start).rel_value) / 1024LL), "kb/s"); | 156 | (start).rel_value_us) / 1024LL), "kb/s"); |
157 | fn = GNUNET_DISK_mktemp ("gnunet-download-test-dst"); | 157 | fn = GNUNET_DISK_mktemp ("gnunet-download-test-dst"); |
158 | start = GNUNET_TIME_absolute_get (); | 158 | start = GNUNET_TIME_absolute_get (); |
159 | download = | 159 | download = |
@@ -168,18 +168,18 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | |||
168 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: | 168 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: |
169 | fprintf (stdout, | 169 | fprintf (stdout, |
170 | "Download complete, %llu kb/s.\n", | 170 | "Download complete, %llu kb/s.\n", |
171 | (unsigned long long) (FILESIZE * 1000LL / | 171 | (unsigned long long) (FILESIZE * 1000000LL / |
172 | (1 + | 172 | (1 + |
173 | GNUNET_TIME_absolute_get_duration | 173 | GNUNET_TIME_absolute_get_duration |
174 | (start).rel_value) / 1024LL)); | 174 | (start).rel_value_us) / 1024LL)); |
175 | GAUGER ("FS", | 175 | GAUGER ("FS", |
176 | (GNUNET_YES == indexed) | 176 | (GNUNET_YES == indexed) |
177 | ? "Local download speed (indexed)" | 177 | ? "Local download speed (indexed)" |
178 | : "Local download speed (inserted)", | 178 | : "Local download speed (inserted)", |
179 | (unsigned long long) (FILESIZE * 1000LL / | 179 | (unsigned long long) (FILESIZE * 1000000LL / |
180 | (1 + | 180 | (1 + |
181 | GNUNET_TIME_absolute_get_duration | 181 | GNUNET_TIME_absolute_get_duration |
182 | (start).rel_value) / 1024LL), "kb/s"); | 182 | (start).rel_value_us) / 1024LL), "kb/s"); |
183 | GNUNET_SCHEDULER_add_now (&abort_download_task, NULL); | 183 | GNUNET_SCHEDULER_add_now (&abort_download_task, NULL); |
184 | break; | 184 | break; |
185 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: | 185 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: |
diff --git a/src/fs/test_fs_download_persistence.c b/src/fs/test_fs_download_persistence.c index d5883874d..b380fd4af 100644 --- a/src/fs/test_fs_download_persistence.c +++ b/src/fs/test_fs_download_persistence.c | |||
@@ -164,10 +164,10 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | |||
164 | break; | 164 | break; |
165 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: | 165 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: |
166 | printf ("Publishing complete, %llu kbps.\n", | 166 | printf ("Publishing complete, %llu kbps.\n", |
167 | (unsigned long long) (FILESIZE * 1000LL / | 167 | (unsigned long long) (FILESIZE * 1000000LL / |
168 | (1 + | 168 | (1 + |
169 | GNUNET_TIME_absolute_get_duration | 169 | GNUNET_TIME_absolute_get_duration |
170 | (start).rel_value) / 1024LL)); | 170 | (start).rel_value_us) / 1024LL)); |
171 | fn = GNUNET_DISK_mktemp ("gnunet-download-test-dst"); | 171 | fn = GNUNET_DISK_mktemp ("gnunet-download-test-dst"); |
172 | start = GNUNET_TIME_absolute_get (); | 172 | start = GNUNET_TIME_absolute_get (); |
173 | GNUNET_assert (download == NULL); | 173 | GNUNET_assert (download == NULL); |
@@ -179,10 +179,10 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | |||
179 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: | 179 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: |
180 | consider_restart (event->status); | 180 | consider_restart (event->status); |
181 | printf ("Download complete, %llu kbps.\n", | 181 | printf ("Download complete, %llu kbps.\n", |
182 | (unsigned long long) (FILESIZE * 1000LL / | 182 | (unsigned long long) (FILESIZE * 1000000LL / |
183 | (1 + | 183 | (1 + |
184 | GNUNET_TIME_absolute_get_duration | 184 | GNUNET_TIME_absolute_get_duration |
185 | (start).rel_value) / 1024LL)); | 185 | (start).rel_value_us) / 1024LL)); |
186 | GNUNET_SCHEDULER_add_now (&abort_download_task, NULL); | 186 | GNUNET_SCHEDULER_add_now (&abort_download_task, NULL); |
187 | break; | 187 | break; |
188 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: | 188 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: |
diff --git a/src/fs/test_fs_list_indexed.c b/src/fs/test_fs_list_indexed.c index 91dad7ca9..b505e8a18 100644 --- a/src/fs/test_fs_list_indexed.c +++ b/src/fs/test_fs_list_indexed.c | |||
@@ -95,10 +95,10 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | |||
95 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: | 95 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: |
96 | ret = event->value.publish.cctx; | 96 | ret = event->value.publish.cctx; |
97 | printf ("Publish complete, %llu kbps.\n", | 97 | printf ("Publish complete, %llu kbps.\n", |
98 | (unsigned long long) (FILESIZE * 1000 / | 98 | (unsigned long long) (FILESIZE * 1000000LL / |
99 | (1 + | 99 | (1 + |
100 | GNUNET_TIME_absolute_get_duration | 100 | GNUNET_TIME_absolute_get_duration |
101 | (start).rel_value) / 1024)); | 101 | (start).rel_value_us) / 1024)); |
102 | if (0 == strcmp ("list_indexed-context-dir", event->value.publish.cctx)) | 102 | if (0 == strcmp ("list_indexed-context-dir", event->value.publish.cctx)) |
103 | GNUNET_SCHEDULER_add_continuation (&list_indexed_task, NULL, | 103 | GNUNET_SCHEDULER_add_continuation (&list_indexed_task, NULL, |
104 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 104 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
diff --git a/src/fs/test_fs_publish.c b/src/fs/test_fs_publish.c index e51d6e5d4..7ff9c9202 100644 --- a/src/fs/test_fs_publish.c +++ b/src/fs/test_fs_publish.c | |||
@@ -82,10 +82,10 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | |||
82 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: | 82 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: |
83 | ret = event->value.publish.cctx; | 83 | ret = event->value.publish.cctx; |
84 | printf ("Publish complete, %llu kbps.\n", | 84 | printf ("Publish complete, %llu kbps.\n", |
85 | (unsigned long long) (FILESIZE * 1000 / | 85 | (unsigned long long) (FILESIZE * 1000000LL / |
86 | (1 + | 86 | (1 + |
87 | GNUNET_TIME_absolute_get_duration | 87 | GNUNET_TIME_absolute_get_duration |
88 | (start).rel_value) / 1024)); | 88 | (start).rel_value_us) / 1024)); |
89 | if (0 == strcmp ("publish-context-dir", event->value.publish.cctx)) | 89 | if (0 == strcmp ("publish-context-dir", event->value.publish.cctx)) |
90 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL, | 90 | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL, |
91 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 91 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
diff --git a/src/fs/test_fs_publish_persistence.c b/src/fs/test_fs_publish_persistence.c index 577831a28..1dc8c43aa 100644 --- a/src/fs/test_fs_publish_persistence.c +++ b/src/fs/test_fs_publish_persistence.c | |||
@@ -134,10 +134,10 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | |||
134 | consider_restart (event->status); | 134 | consider_restart (event->status); |
135 | ret = event->value.publish.cctx; | 135 | ret = event->value.publish.cctx; |
136 | printf ("Publish complete, %llu kbps.\n", | 136 | printf ("Publish complete, %llu kbps.\n", |
137 | (unsigned long long) (FILESIZE * 1000LL / | 137 | (unsigned long long) (FILESIZE * 1000000LL / |
138 | (1 + | 138 | (1 + |
139 | GNUNET_TIME_absolute_get_duration | 139 | GNUNET_TIME_absolute_get_duration |
140 | (start).rel_value) / 1024)); | 140 | (start).rel_value_us) / 1024)); |
141 | if (0 == strcmp ("publish-context-dir", event->value.publish.cctx)) | 141 | if (0 == strcmp ("publish-context-dir", event->value.publish.cctx)) |
142 | GNUNET_SCHEDULER_add_now (&abort_publish_task, NULL); | 142 | GNUNET_SCHEDULER_add_now (&abort_publish_task, NULL); |
143 | break; | 143 | break; |
diff --git a/src/fs/test_fs_unindex.c b/src/fs/test_fs_unindex.c index 6b89dcad8..033195f0b 100644 --- a/src/fs/test_fs_unindex.c +++ b/src/fs/test_fs_unindex.c | |||
@@ -92,20 +92,20 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | |||
92 | break; | 92 | break; |
93 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: | 93 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: |
94 | printf ("Publishing complete, %llu kbps.\n", | 94 | printf ("Publishing complete, %llu kbps.\n", |
95 | (unsigned long long) (FILESIZE * 1000 / | 95 | (unsigned long long) (FILESIZE * 1000000LL / |
96 | (1 + | 96 | (1 + |
97 | GNUNET_TIME_absolute_get_duration | 97 | GNUNET_TIME_absolute_get_duration |
98 | (start).rel_value) / 1024)); | 98 | (start).rel_value_us) / 1024)); |
99 | start = GNUNET_TIME_absolute_get (); | 99 | start = GNUNET_TIME_absolute_get (); |
100 | unindex = GNUNET_FS_unindex_start (fs, fn, "unindex"); | 100 | unindex = GNUNET_FS_unindex_start (fs, fn, "unindex"); |
101 | GNUNET_assert (unindex != NULL); | 101 | GNUNET_assert (unindex != NULL); |
102 | break; | 102 | break; |
103 | case GNUNET_FS_STATUS_UNINDEX_COMPLETED: | 103 | case GNUNET_FS_STATUS_UNINDEX_COMPLETED: |
104 | printf ("Unindex complete, %llu kbps.\n", | 104 | printf ("Unindex complete, %llu kbps.\n", |
105 | (unsigned long long) (FILESIZE * 1000 / | 105 | (unsigned long long) (FILESIZE * 1000000LL / |
106 | (1 + | 106 | (1 + |
107 | GNUNET_TIME_absolute_get_duration | 107 | GNUNET_TIME_absolute_get_duration |
108 | (start).rel_value) / 1024)); | 108 | (start).rel_value_us) / 1024)); |
109 | GNUNET_SCHEDULER_add_continuation (&abort_unindex_task, NULL, | 109 | GNUNET_SCHEDULER_add_continuation (&abort_unindex_task, NULL, |
110 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 110 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
111 | break; | 111 | break; |
diff --git a/src/fs/test_fs_unindex_persistence.c b/src/fs/test_fs_unindex_persistence.c index b11748e2a..ef143ecef 100644 --- a/src/fs/test_fs_unindex_persistence.c +++ b/src/fs/test_fs_unindex_persistence.c | |||
@@ -134,20 +134,20 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event) | |||
134 | break; | 134 | break; |
135 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: | 135 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: |
136 | printf ("Publishing complete, %llu kbps.\n", | 136 | printf ("Publishing complete, %llu kbps.\n", |
137 | (unsigned long long) (FILESIZE * 1000 / | 137 | (unsigned long long) (FILESIZE * 1000000LL / |
138 | (1 + | 138 | (1 + |
139 | GNUNET_TIME_absolute_get_duration | 139 | GNUNET_TIME_absolute_get_duration |
140 | (start).rel_value) / 1024)); | 140 | (start).rel_value_us) / 1024)); |
141 | start = GNUNET_TIME_absolute_get (); | 141 | start = GNUNET_TIME_absolute_get (); |
142 | unindex = GNUNET_FS_unindex_start (fs, fn, "unindex"); | 142 | unindex = GNUNET_FS_unindex_start (fs, fn, "unindex"); |
143 | GNUNET_assert (unindex != NULL); | 143 | GNUNET_assert (unindex != NULL); |
144 | break; | 144 | break; |
145 | case GNUNET_FS_STATUS_UNINDEX_COMPLETED: | 145 | case GNUNET_FS_STATUS_UNINDEX_COMPLETED: |
146 | printf ("Unindex complete, %llu kbps.\n", | 146 | printf ("Unindex complete, %llu kbps.\n", |
147 | (unsigned long long) (FILESIZE * 1000 / | 147 | (unsigned long long) (FILESIZE * 1000000LL / |
148 | (1 + | 148 | (1 + |
149 | GNUNET_TIME_absolute_get_duration | 149 | GNUNET_TIME_absolute_get_duration |
150 | (start).rel_value) / 1024)); | 150 | (start).rel_value_us) / 1024)); |
151 | GNUNET_SCHEDULER_add_continuation (&abort_unindex_task, NULL, | 151 | GNUNET_SCHEDULER_add_continuation (&abort_unindex_task, NULL, |
152 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 152 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
153 | break; | 153 | break; |
diff --git a/src/fs/test_gnunet_service_fs_migration.c b/src/fs/test_gnunet_service_fs_migration.c index 138e35c47..58e6374d5 100644 --- a/src/fs/test_gnunet_service_fs_migration.c +++ b/src/fs/test_gnunet_service_fs_migration.c | |||
@@ -73,11 +73,11 @@ do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
73 | if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) | 73 | if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) |
74 | { | 74 | { |
75 | del = GNUNET_TIME_absolute_get_duration (start_time); | 75 | del = GNUNET_TIME_absolute_get_duration (start_time); |
76 | if (del.rel_value == 0) | 76 | if (del.rel_value_us == 0) |
77 | del.rel_value = 1; | 77 | del.rel_value_us = 1; |
78 | fancy = | 78 | fancy = |
79 | GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) * | 79 | GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) * |
80 | 1000LL / del.rel_value); | 80 | 1000000LL / del.rel_value_us); |
81 | FPRINTF (stdout, "Download speed was %s/s\n", fancy); | 81 | FPRINTF (stdout, "Download speed was %s/s\n", fancy); |
82 | GNUNET_free (fancy); | 82 | GNUNET_free (fancy); |
83 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished download, shutting down\n", | 83 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished download, shutting down\n", |
diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c index e37a322b8..63f5627c2 100644 --- a/src/fs/test_gnunet_service_fs_p2p.c +++ b/src/fs/test_gnunet_service_fs_p2p.c | |||
@@ -64,11 +64,11 @@ do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
64 | if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) | 64 | if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) |
65 | { | 65 | { |
66 | del = GNUNET_TIME_absolute_get_duration (start_time); | 66 | del = GNUNET_TIME_absolute_get_duration (start_time); |
67 | if (del.rel_value == 0) | 67 | if (del.rel_value_us == 0) |
68 | del.rel_value = 1; | 68 | del.rel_value_us = 1; |
69 | fancy = | 69 | fancy = |
70 | GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) * | 70 | GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) * |
71 | 1000LL / del.rel_value); | 71 | 1000000LL / del.rel_value_us); |
72 | FPRINTF (stdout, "Download speed was %s/s\n", fancy); | 72 | FPRINTF (stdout, "Download speed was %s/s\n", fancy); |
73 | GNUNET_free (fancy); | 73 | GNUNET_free (fancy); |
74 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished download, shutting down\n", | 74 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished download, shutting down\n", |
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c index ec64f0730..c1fdc2dc8 100644 --- a/src/gns/gnunet-dns2gns.c +++ b/src/gns/gnunet-dns2gns.c | |||
@@ -282,7 +282,7 @@ result_processor (void *cls, | |||
282 | //packet->flags.opcode = GNUNET_DNSPARSER_OPCODE_STATUS; // ??? | 282 | //packet->flags.opcode = GNUNET_DNSPARSER_OPCODE_STATUS; // ??? |
283 | for (i=0;i<rd_count;i++) | 283 | for (i=0;i<rd_count;i++) |
284 | { | 284 | { |
285 | rec.expiration_time.abs_value = rd[i].expiration_time; | 285 | rec.expiration_time.abs_value_us = rd[i].expiration_time; |
286 | switch (rd[i].record_type) | 286 | switch (rd[i].record_type) |
287 | { | 287 | { |
288 | case GNUNET_DNSPARSER_TYPE_A: | 288 | case GNUNET_DNSPARSER_TYPE_A: |
diff --git a/src/gns/gnunet-gns-fcfsd.c b/src/gns/gnunet-gns-fcfsd.c index 832060583..dd4572cb1 100644 --- a/src/gns/gnunet-gns-fcfsd.c +++ b/src/gns/gnunet-gns-fcfsd.c | |||
@@ -804,7 +804,7 @@ run_httpd () | |||
804 | GNUNET_assert (MHD_YES == MHD_get_fdset (httpd, &rs, &ws, &es, &max)); | 804 | GNUNET_assert (MHD_YES == MHD_get_fdset (httpd, &rs, &ws, &es, &max)); |
805 | haveto = MHD_get_timeout (httpd, &timeout); | 805 | haveto = MHD_get_timeout (httpd, &timeout); |
806 | if (haveto == MHD_YES) | 806 | if (haveto == MHD_YES) |
807 | tv.rel_value = (uint64_t) timeout; | 807 | tv.rel_value_us = (uint64_t) timeout * 1000LL; |
808 | else | 808 | else |
809 | tv = GNUNET_TIME_UNIT_FOREVER_REL; | 809 | tv = GNUNET_TIME_UNIT_FOREVER_REL; |
810 | GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); | 810 | GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); |
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index 4752422dd..46b16c323 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c | |||
@@ -2200,7 +2200,7 @@ run_httpd (struct MhdHttpList *hd) | |||
2200 | haveto = MHD_get_timeout (hd->daemon, &timeout); | 2200 | haveto = MHD_get_timeout (hd->daemon, &timeout); |
2201 | 2201 | ||
2202 | if (MHD_YES == haveto) | 2202 | if (MHD_YES == haveto) |
2203 | tv.rel_value = (uint64_t) timeout; | 2203 | tv.rel_value_us = (uint64_t) timeout * 1000LL; |
2204 | else | 2204 | else |
2205 | tv = GNUNET_TIME_UNIT_FOREVER_REL; | 2205 | tv = GNUNET_TIME_UNIT_FOREVER_REL; |
2206 | GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); | 2206 | GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); |
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index 8200e3f87..1bff3e51d 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c | |||
@@ -427,7 +427,7 @@ put_gns_record (void *cls, | |||
427 | GNUNET_STRINGS_relative_time_to_string (put_interval, GNUNET_YES)); | 427 | GNUNET_STRINGS_relative_time_to_string (put_interval, GNUNET_YES)); |
428 | GNUNET_STATISTICS_set (statistics, | 428 | GNUNET_STATISTICS_set (statistics, |
429 | "Current zone iteration interval (in ms)", | 429 | "Current zone iteration interval (in ms)", |
430 | put_interval.rel_value, | 430 | put_interval.rel_value_us / 1000LL, |
431 | GNUNET_NO); | 431 | GNUNET_NO); |
432 | GNUNET_STATISTICS_update (statistics, | 432 | GNUNET_STATISTICS_update (statistics, |
433 | "Number of zone iterations", 1, GNUNET_NO); | 433 | "Number of zone iterations", 1, GNUNET_NO); |
@@ -545,7 +545,7 @@ put_gns_record (void *cls, | |||
545 | 545 | ||
546 | GNUNET_STATISTICS_set (statistics, | 546 | GNUNET_STATISTICS_set (statistics, |
547 | "Current zone iteration interval (ms)", | 547 | "Current zone iteration interval (ms)", |
548 | next_put_interval.rel_value, | 548 | next_put_interval.rel_value_us / 1000LL, |
549 | GNUNET_NO); | 549 | GNUNET_NO); |
550 | zone_publish_task = GNUNET_SCHEDULER_add_delayed (next_put_interval, | 550 | zone_publish_task = GNUNET_SCHEDULER_add_delayed (next_put_interval, |
551 | &publish_zone_dht_next, | 551 | &publish_zone_dht_next, |
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c index affa0f5d6..8f55b8284 100644 --- a/src/gns/gnunet-service-gns_interceptor.c +++ b/src/gns/gnunet-service-gns_interceptor.c | |||
@@ -141,7 +141,7 @@ reply_to_dns (void* cls, uint32_t rd_count, | |||
141 | answer_records[i].data.raw.data = (char*)rd[i].data; | 141 | answer_records[i].data.raw.data = (char*)rd[i].data; |
142 | } | 142 | } |
143 | GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); | 143 | GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); |
144 | answer_records[i].expiration_time.abs_value = rd[i].expiration_time; | 144 | answer_records[i].expiration_time.abs_value_us = rd[i].expiration_time; |
145 | answer_records[i].class = GNUNET_DNSPARSER_CLASS_INTERNET;//hmmn | 145 | answer_records[i].class = GNUNET_DNSPARSER_CLASS_INTERNET;//hmmn |
146 | } | 146 | } |
147 | else | 147 | else |
@@ -168,7 +168,7 @@ reply_to_dns (void* cls, uint32_t rd_count, | |||
168 | additional_records[i].data.raw.data = (char*)rd[i].data; | 168 | additional_records[i].data.raw.data = (char*)rd[i].data; |
169 | } | 169 | } |
170 | GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); | 170 | GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); |
171 | additional_records[i].expiration_time.abs_value = rd[i].expiration_time; | 171 | additional_records[i].expiration_time.abs_value_us = rd[i].expiration_time; |
172 | additional_records[i].class = GNUNET_DNSPARSER_CLASS_INTERNET;//hmmn | 172 | additional_records[i].class = GNUNET_DNSPARSER_CLASS_INTERNET;//hmmn |
173 | } | 173 | } |
174 | } | 174 | } |
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 2e96b60ea..bd9daf56e 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -888,8 +888,10 @@ dht_lookup_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
888 | char new_name[GNUNET_DNSPARSER_MAX_NAME_LENGTH]; | 888 | char new_name[GNUNET_DNSPARSER_MAX_NAME_LENGTH]; |
889 | 889 | ||
890 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 890 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
891 | "GNS_PHASE_REC-%llu: dht lookup for query %s (%llus) timed out.\n", | 891 | "GNS_PHASE_REC-%llu: dht lookup for query %s (%s) timed out.\n", |
892 | rh->id, rh->name, rh->timeout.rel_value); | 892 | rh->id, rh->name, |
893 | GNUNET_STRINGS_relative_time_to_string (rh->timeout, | ||
894 | GNUNET_YES)); | ||
893 | /** | 895 | /** |
894 | * Start resolution in bg | 896 | * Start resolution in bg |
895 | */ | 897 | */ |
@@ -1042,7 +1044,7 @@ process_record_result_dht (void* cls, | |||
1042 | 1044 | ||
1043 | namestore_bg_task->node = GNUNET_CONTAINER_heap_insert (ns_task_heap, | 1045 | namestore_bg_task->node = GNUNET_CONTAINER_heap_insert (ns_task_heap, |
1044 | namestore_bg_task, | 1046 | namestore_bg_task, |
1045 | GNUNET_TIME_absolute_get().abs_value); | 1047 | GNUNET_TIME_absolute_get().abs_value_us); |
1046 | if (0 < rh->answered) | 1048 | if (0 < rh->answered) |
1047 | rh->proc (rh->proc_cls, rh, num_records, rd); | 1049 | rh->proc (rh->proc_cls, rh, num_records, rd); |
1048 | else | 1050 | else |
@@ -1072,7 +1074,7 @@ resolve_record_dht (struct ResolverHandle *rh) | |||
1072 | 1074 | ||
1073 | rh->dht_heap_node = NULL; | 1075 | rh->dht_heap_node = NULL; |
1074 | 1076 | ||
1075 | if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value != rh->timeout.rel_value) | 1077 | if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != rh->timeout.rel_value_us) |
1076 | { | 1078 | { |
1077 | /** | 1079 | /** |
1078 | * Update timeout if necessary | 1080 | * Update timeout if necessary |
@@ -1114,7 +1116,7 @@ resolve_record_dht (struct ResolverHandle *rh) | |||
1114 | } | 1116 | } |
1115 | rh->dht_heap_node = GNUNET_CONTAINER_heap_insert (dht_lookup_heap, | 1117 | rh->dht_heap_node = GNUNET_CONTAINER_heap_insert (dht_lookup_heap, |
1116 | rh, | 1118 | rh, |
1117 | GNUNET_TIME_absolute_get ().abs_value); | 1119 | GNUNET_TIME_absolute_get ().abs_value_us); |
1118 | } | 1120 | } |
1119 | 1121 | ||
1120 | xquery = htonl (rlh->record_type); | 1122 | xquery = htonl (rlh->record_type); |
@@ -1169,7 +1171,7 @@ process_record_result_ns (void* cls, | |||
1169 | if (NULL != name) | 1171 | if (NULL != name) |
1170 | { | 1172 | { |
1171 | rh->status |= RSL_RECORD_EXISTS; | 1173 | rh->status |= RSL_RECORD_EXISTS; |
1172 | if (remaining_time.rel_value == 0) | 1174 | if (remaining_time.rel_value_us == 0) |
1173 | rh->status |= RSL_RECORD_EXPIRED; | 1175 | rh->status |= RSL_RECORD_EXPIRED; |
1174 | } | 1176 | } |
1175 | if (0 == rd_count) | 1177 | if (0 == rd_count) |
@@ -1210,8 +1212,8 @@ process_record_result_ns (void* cls, | |||
1210 | 1212 | ||
1211 | //FIXME: eh? do I have to handle this here? | 1213 | //FIXME: eh? do I have to handle this here? |
1212 | GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); | 1214 | GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); |
1213 | et.abs_value = rd[i].expiration_time; | 1215 | et.abs_value_us = rd[i].expiration_time; |
1214 | if (0 == (GNUNET_TIME_absolute_get_remaining (et)).rel_value) | 1216 | if (0 == (GNUNET_TIME_absolute_get_remaining (et)).rel_value_us) |
1215 | { | 1217 | { |
1216 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1218 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1217 | "GNS_PHASE_REC-%llu: This record is expired. Skipping\n", | 1219 | "GNS_PHASE_REC-%llu: This record is expired. Skipping\n", |
@@ -1554,7 +1556,7 @@ read_dns_response (void *cls, | |||
1554 | rd.data_size = packet->answers[i].data.raw.data_len; | 1556 | rd.data_size = packet->answers[i].data.raw.data_len; |
1555 | rd.record_type = packet->answers[i].type; | 1557 | rd.record_type = packet->answers[i].type; |
1556 | rd.flags = 0; | 1558 | rd.flags = 0; |
1557 | rd.expiration_time = packet->answers[i].expiration_time.abs_value; | 1559 | rd.expiration_time = packet->answers[i].expiration_time.abs_value_us; |
1558 | finish_lookup (rh, rlh, 1, &rd); | 1560 | finish_lookup (rh, rlh, 1, &rd); |
1559 | GNUNET_DNSPARSER_free_packet (packet); | 1561 | GNUNET_DNSPARSER_free_packet (packet); |
1560 | return; | 1562 | return; |
@@ -1931,9 +1933,10 @@ dht_authority_lookup_timeout (void *cls, | |||
1931 | char new_name[GNUNET_DNSPARSER_MAX_NAME_LENGTH]; | 1933 | char new_name[GNUNET_DNSPARSER_MAX_NAME_LENGTH]; |
1932 | 1934 | ||
1933 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1935 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1934 | "GNS_PHASE_DELEGATE_DHT-%llu: dht lookup for query %s (%llus) timed out.\n", | 1936 | "GNS_PHASE_DELEGATE_DHT-%llu: dht lookup for query %s (%s) timed out.\n", |
1935 | rh->id, rh->authority_name, | 1937 | rh->id, rh->authority_name, |
1936 | rh->timeout.rel_value); | 1938 | GNUNET_STRINGS_relative_time_to_string (rh->timeout, |
1939 | GNUNET_YES)); | ||
1937 | 1940 | ||
1938 | rh->status |= RSL_TIMED_OUT; | 1941 | rh->status |= RSL_TIMED_OUT; |
1939 | rh->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 1942 | rh->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
@@ -2058,13 +2061,13 @@ process_pkey_revocation_result_ns (void *cls, | |||
2058 | } | 2061 | } |
2059 | 2062 | ||
2060 | if ((NULL == name) || | 2063 | if ((NULL == name) || |
2061 | (0 == remaining_time.rel_value)) | 2064 | (0 == remaining_time.rel_value_us)) |
2062 | { | 2065 | { |
2063 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 2066 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
2064 | "GNS_PHASE_DELEGATE_REV-%llu: + Records don't exist or are expired.\n", | 2067 | "GNS_PHASE_DELEGATE_REV-%llu: + Records don't exist or are expired.\n", |
2065 | rh->id, name); | 2068 | rh->id, name); |
2066 | 2069 | ||
2067 | if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value != rh->timeout.rel_value) | 2070 | if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != rh->timeout.rel_value_us) |
2068 | { | 2071 | { |
2069 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 2072 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
2070 | "GNS_PHASE_DELEGATE_REV-%llu: Starting background lookup for %s type %d\n", | 2073 | "GNS_PHASE_DELEGATE_REV-%llu: Starting background lookup for %s type %d\n", |
@@ -2291,7 +2294,7 @@ process_delegation_result_dht (void* cls, | |||
2291 | 2294 | ||
2292 | namestore_bg_task->node = GNUNET_CONTAINER_heap_insert (ns_task_heap, | 2295 | namestore_bg_task->node = GNUNET_CONTAINER_heap_insert (ns_task_heap, |
2293 | namestore_bg_task, | 2296 | namestore_bg_task, |
2294 | GNUNET_TIME_absolute_get().abs_value); | 2297 | GNUNET_TIME_absolute_get().abs_value_us); |
2295 | namestore_bg_task->qe = GNUNET_NAMESTORE_record_put (namestore_handle, | 2298 | namestore_bg_task->qe = GNUNET_NAMESTORE_record_put (namestore_handle, |
2296 | &nrb->public_key, | 2299 | &nrb->public_key, |
2297 | name, | 2300 | name, |
@@ -2762,7 +2765,7 @@ resolve_delegation_dht (struct ResolverHandle *rh) | |||
2762 | &rh->authority, | 2765 | &rh->authority, |
2763 | &lookup_key); | 2766 | &lookup_key); |
2764 | rh->dht_heap_node = NULL; | 2767 | rh->dht_heap_node = NULL; |
2765 | if (rh->timeout.rel_value != GNUNET_TIME_UNIT_FOREVER_REL.rel_value) | 2768 | if (rh->timeout.rel_value_us != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) |
2766 | { | 2769 | { |
2767 | rh->timeout_cont = &dht_authority_lookup_timeout; | 2770 | rh->timeout_cont = &dht_authority_lookup_timeout; |
2768 | rh->timeout_cont_cls = rh; | 2771 | rh->timeout_cont_cls = rh; |
@@ -2788,7 +2791,7 @@ resolve_delegation_dht (struct ResolverHandle *rh) | |||
2788 | } | 2791 | } |
2789 | rh->dht_heap_node = GNUNET_CONTAINER_heap_insert (dht_lookup_heap, | 2792 | rh->dht_heap_node = GNUNET_CONTAINER_heap_insert (dht_lookup_heap, |
2790 | rh, | 2793 | rh, |
2791 | GNUNET_TIME_absolute_get().abs_value); | 2794 | GNUNET_TIME_absolute_get().abs_value_us); |
2792 | } | 2795 | } |
2793 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2796 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2794 | "Beginning DHT lookup for %s in zone %s for request %llu\n", | 2797 | "Beginning DHT lookup for %s in zone %s for request %llu\n", |
@@ -3096,7 +3099,7 @@ process_delegation_result_ns (void* cls, | |||
3096 | GNUNET_short_h2s (&zone)); | 3099 | GNUNET_short_h2s (&zone)); |
3097 | rh->status |= RSL_RECORD_EXISTS; | 3100 | rh->status |= RSL_RECORD_EXISTS; |
3098 | 3101 | ||
3099 | if (0 == remaining_time.rel_value) | 3102 | if (0 == remaining_time.rel_value_us) |
3100 | { | 3103 | { |
3101 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3104 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3102 | "GNS_PHASE_DELEGATE_NS-%llu: Record set %s expired.\n", | 3105 | "GNS_PHASE_DELEGATE_NS-%llu: Record set %s expired.\n", |
@@ -3194,13 +3197,13 @@ process_delegation_result_ns (void* cls, | |||
3194 | continue; | 3197 | continue; |
3195 | } | 3198 | } |
3196 | GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); | 3199 | GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); |
3197 | et.abs_value = rd[i].expiration_time; | 3200 | et.abs_value_us = rd[i].expiration_time; |
3198 | if (0 == (GNUNET_TIME_absolute_get_remaining (et)).rel_value) | 3201 | if (0 == (GNUNET_TIME_absolute_get_remaining (et)).rel_value_us) |
3199 | { | 3202 | { |
3200 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3203 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3201 | "GNS_PHASE_DELEGATE_NS-%llu: This pkey is expired.\n", | 3204 | "GNS_PHASE_DELEGATE_NS-%llu: This pkey is expired.\n", |
3202 | rh->id); | 3205 | rh->id); |
3203 | if (remaining_time.rel_value == 0) | 3206 | if (remaining_time.rel_value_us == 0) |
3204 | { | 3207 | { |
3205 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3208 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3206 | "GNS_PHASE_DELEGATE_NS-%llu: This dht entry is expired.\n", | 3209 | "GNS_PHASE_DELEGATE_NS-%llu: This dht entry is expired.\n", |
@@ -3364,7 +3367,7 @@ gns_resolver_lookup_record (struct GNUNET_CRYPTO_ShortHashCode zone, | |||
3364 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3367 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3365 | "No shorten key for resolution\n"); | 3368 | "No shorten key for resolution\n"); |
3366 | 3369 | ||
3367 | if (timeout.rel_value != GNUNET_TIME_UNIT_FOREVER_REL.rel_value) | 3370 | if (timeout.rel_value_us != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) |
3368 | { | 3371 | { |
3369 | /* | 3372 | /* |
3370 | * Set timeout for authority lookup phase to 1/2 | 3373 | * Set timeout for authority lookup phase to 1/2 |
diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c index ffc38c99b..4d12f02df 100644 --- a/src/gns/plugin_block_gns.c +++ b/src/gns/plugin_block_gns.c | |||
@@ -166,11 +166,12 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, | |||
166 | record_match++; | 166 | record_match++; |
167 | } | 167 | } |
168 | } | 168 | } |
169 | et.abs_value = exp; | 169 | et.abs_value_us = exp; |
170 | 170 | ||
171 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 171 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
172 | "Verifying signature of %d records for name %s with expiration of %u\n", | 172 | "Verifying signature of %d records for name %s with expiration of %s\n", |
173 | rd_count, name, et.abs_value); | 173 | rd_count, name, |
174 | GNUNET_STRINGS_absolute_time_to_string (et)); | ||
174 | 175 | ||
175 | if (GNUNET_OK != | 176 | if (GNUNET_OK != |
176 | GNUNET_NAMESTORE_verify_signature (&nrb->public_key, | 177 | GNUNET_NAMESTORE_verify_signature (&nrb->public_key, |
diff --git a/src/gns/test_gns_dht_three_peers.c b/src/gns/test_gns_dht_three_peers.c index 35a738aef..11f78db4b 100644 --- a/src/gns/test_gns_dht_three_peers.c +++ b/src/gns/test_gns_dht_three_peers.c | |||
@@ -250,12 +250,14 @@ on_lookup_result(void *cls, uint32_t rd_count, | |||
250 | end_now (); | 250 | end_now (); |
251 | } | 251 | } |
252 | 252 | ||
253 | |||
253 | static void | 254 | static void |
254 | commence_testing(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 255 | commence_testing(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
255 | { | 256 | { |
256 | static int wait = 0; | 257 | static int wait = 0; |
258 | |||
257 | wait++; | 259 | wait++; |
258 | if ((ZONE_PUT_WAIT_TIME.rel_value / 1000) == wait) | 260 | if ((ZONE_PUT_WAIT_TIME.rel_value_us / 1000LL / 1000LL) == wait) |
259 | { | 261 | { |
260 | fprintf (stderr, "\n"); | 262 | fprintf (stderr, "\n"); |
261 | wait_task = GNUNET_SCHEDULER_NO_TASK; | 263 | wait_task = GNUNET_SCHEDULER_NO_TASK; |
@@ -274,6 +276,7 @@ commence_testing(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
274 | } | 276 | } |
275 | } | 277 | } |
276 | 278 | ||
279 | |||
277 | void | 280 | void |
278 | all_connected () | 281 | all_connected () |
279 | { | 282 | { |
diff --git a/src/gns/test_gns_proxy.c b/src/gns/test_gns_proxy.c index cfbcb1d9e..050e2d258 100644 --- a/src/gns/test_gns_proxy.c +++ b/src/gns/test_gns_proxy.c | |||
@@ -422,7 +422,7 @@ run (void *cls, | |||
422 | } | 422 | } |
423 | 423 | ||
424 | host_key = GNUNET_CRYPTO_ecc_key_create_from_file (zone_keyfile); | 424 | host_key = GNUNET_CRYPTO_ecc_key_create_from_file (zone_keyfile); |
425 | rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value; | 425 | rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; |
426 | GNUNET_assert (GNUNET_OK == GNUNET_NAMESTORE_string_to_value (GNUNET_GNS_RECORD_A, | 426 | GNUNET_assert (GNUNET_OK == GNUNET_NAMESTORE_string_to_value (GNUNET_GNS_RECORD_A, |
427 | "127.0.0.1", | 427 | "127.0.0.1", |
428 | (void**)&rd.data, | 428 | (void**)&rd.data, |
diff --git a/src/gns/test_gns_pseu_shorten.c b/src/gns/test_gns_pseu_shorten.c index 7413c7074..ba7cd2492 100644 --- a/src/gns/test_gns_pseu_shorten.c +++ b/src/gns/test_gns_pseu_shorten.c | |||
@@ -269,7 +269,7 @@ put_pseu_dht (void *cls, int success) | |||
269 | struct GNUNET_NAMESTORE_RecordData rd; | 269 | struct GNUNET_NAMESTORE_RecordData rd; |
270 | 270 | ||
271 | memset (&rd, 0, sizeof (struct GNUNET_NAMESTORE_RecordData)); | 271 | memset (&rd, 0, sizeof (struct GNUNET_NAMESTORE_RecordData)); |
272 | rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value; | 272 | rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; |
273 | rd.data_size = strlen(TEST_PSEU_ALICE)+1; | 273 | rd.data_size = strlen(TEST_PSEU_ALICE)+1; |
274 | rd.data = TEST_PSEU_ALICE; | 274 | rd.data = TEST_PSEU_ALICE; |
275 | rd.record_type = GNUNET_GNS_RECORD_PSEU; | 275 | rd.record_type = GNUNET_GNS_RECORD_PSEU; |
diff --git a/src/gns/test_gns_simple_delegated_lookup.c b/src/gns/test_gns_simple_delegated_lookup.c index ff19569d6..8b5f8bc38 100644 --- a/src/gns/test_gns_simple_delegated_lookup.c +++ b/src/gns/test_gns_simple_delegated_lookup.c | |||
@@ -247,7 +247,7 @@ do_check (void *cls, | |||
247 | GNUNET_TIME_UNIT_FOREVER_ABS, | 247 | GNUNET_TIME_UNIT_FOREVER_ABS, |
248 | TEST_RECORD_NAME, | 248 | TEST_RECORD_NAME, |
249 | &rd, 1); | 249 | &rd, 1); |
250 | et.abs_value = rd.expiration_time; | 250 | et.abs_value_us = rd.expiration_time; |
251 | GNUNET_NAMESTORE_record_put (namestore_handle, | 251 | GNUNET_NAMESTORE_record_put (namestore_handle, |
252 | &bob_pkey, | 252 | &bob_pkey, |
253 | TEST_RECORD_NAME, | 253 | TEST_RECORD_NAME, |
diff --git a/src/gns/test_gns_simple_mx_lookup.c b/src/gns/test_gns_simple_mx_lookup.c index 904758bde..b078edc4f 100644 --- a/src/gns/test_gns_simple_mx_lookup.c +++ b/src/gns/test_gns_simple_mx_lookup.c | |||
@@ -245,7 +245,7 @@ do_check (void *cls, | |||
245 | GNUNET_TIME_UNIT_FOREVER_ABS, | 245 | GNUNET_TIME_UNIT_FOREVER_ABS, |
246 | TEST_RECORD_NAME, | 246 | TEST_RECORD_NAME, |
247 | &rd, 1); | 247 | &rd, 1); |
248 | et.abs_value = rd.expiration_time; | 248 | et.abs_value_us = rd.expiration_time; |
249 | GNUNET_NAMESTORE_record_put (namestore_handle, | 249 | GNUNET_NAMESTORE_record_put (namestore_handle, |
250 | &bob_pkey, | 250 | &bob_pkey, |
251 | TEST_RECORD_NAME, | 251 | TEST_RECORD_NAME, |
@@ -267,7 +267,7 @@ do_check (void *cls, | |||
267 | GNUNET_TIME_UNIT_FOREVER_ABS, | 267 | GNUNET_TIME_UNIT_FOREVER_ABS, |
268 | GNUNET_GNS_MASTERZONE_STR, | 268 | GNUNET_GNS_MASTERZONE_STR, |
269 | &rd, 1); | 269 | &rd, 1); |
270 | et.abs_value = rd.expiration_time; | 270 | et.abs_value_us = rd.expiration_time; |
271 | GNUNET_NAMESTORE_record_put (namestore_handle, | 271 | GNUNET_NAMESTORE_record_put (namestore_handle, |
272 | &bob_pkey, | 272 | &bob_pkey, |
273 | GNUNET_GNS_MASTERZONE_STR, | 273 | GNUNET_GNS_MASTERZONE_STR, |
diff --git a/src/gns/test_gns_simple_srv_lookup.c b/src/gns/test_gns_simple_srv_lookup.c index a403bf554..601d01af9 100644 --- a/src/gns/test_gns_simple_srv_lookup.c +++ b/src/gns/test_gns_simple_srv_lookup.c | |||
@@ -251,7 +251,7 @@ do_check (void *cls, | |||
251 | GNUNET_TIME_UNIT_FOREVER_ABS, | 251 | GNUNET_TIME_UNIT_FOREVER_ABS, |
252 | TEST_RECORD_NAME, | 252 | TEST_RECORD_NAME, |
253 | &rd, 1); | 253 | &rd, 1); |
254 | et.abs_value = rd.expiration_time; | 254 | et.abs_value_us = rd.expiration_time; |
255 | GNUNET_NAMESTORE_record_put (namestore_handle, | 255 | GNUNET_NAMESTORE_record_put (namestore_handle, |
256 | &bob_pkey, | 256 | &bob_pkey, |
257 | TEST_RECORD_NAME, | 257 | TEST_RECORD_NAME, |
@@ -274,7 +274,7 @@ do_check (void *cls, | |||
274 | GNUNET_TIME_UNIT_FOREVER_ABS, | 274 | GNUNET_TIME_UNIT_FOREVER_ABS, |
275 | TEST_RECORD_NAME_SRV, | 275 | TEST_RECORD_NAME_SRV, |
276 | &rd, 1); | 276 | &rd, 1); |
277 | et.abs_value = rd.expiration_time; | 277 | et.abs_value_us = rd.expiration_time; |
278 | GNUNET_NAMESTORE_record_put (namestore_handle, | 278 | GNUNET_NAMESTORE_record_put (namestore_handle, |
279 | &bob_pkey, | 279 | &bob_pkey, |
280 | TEST_RECORD_NAME_SRV, | 280 | TEST_RECORD_NAME_SRV, |
diff --git a/src/hello/hello.c b/src/hello/hello.c index d2e143579..a6fe6102f 100644 --- a/src/hello/hello.c +++ b/src/hello/hello.c | |||
@@ -382,8 +382,8 @@ copy_latest (void *cls, const struct GNUNET_HELLO_Address *address, | |||
382 | ec.found = GNUNET_NO; | 382 | ec.found = GNUNET_NO; |
383 | GNUNET_HELLO_iterate_addresses (mc->other, GNUNET_NO, &get_match_exp, &ec); | 383 | GNUNET_HELLO_iterate_addresses (mc->other, GNUNET_NO, &get_match_exp, &ec); |
384 | if ((ec.found == GNUNET_NO) || | 384 | if ((ec.found == GNUNET_NO) || |
385 | (ec.expiration.abs_value < expiration.abs_value) || | 385 | (ec.expiration.abs_value_us < expiration.abs_value_us) || |
386 | ((ec.expiration.abs_value == expiration.abs_value) && | 386 | ((ec.expiration.abs_value_us == expiration.abs_value_us) && |
387 | (mc->take_equal == GNUNET_YES))) | 387 | (mc->take_equal == GNUNET_YES))) |
388 | { | 388 | { |
389 | mc->ret += | 389 | mc->ret += |
@@ -465,8 +465,8 @@ delta_match (void *cls, const struct GNUNET_HELLO_Address *address, | |||
465 | GNUNET_HELLO_iterate_addresses (dc->old_hello, GNUNET_NO, &get_match_exp, | 465 | GNUNET_HELLO_iterate_addresses (dc->old_hello, GNUNET_NO, &get_match_exp, |
466 | &ec); | 466 | &ec); |
467 | if ((ec.found == GNUNET_YES) && | 467 | if ((ec.found == GNUNET_YES) && |
468 | ((ec.expiration.abs_value > expiration.abs_value) || | 468 | ((ec.expiration.abs_value_us > expiration.abs_value_us) || |
469 | (ec.expiration.abs_value >= dc->expiration_limit.abs_value))) | 469 | (ec.expiration.abs_value_us >= dc->expiration_limit.abs_value_us))) |
470 | return GNUNET_YES; /* skip */ | 470 | return GNUNET_YES; /* skip */ |
471 | ret = dc->it (dc->it_cls, address, expiration); | 471 | ret = dc->it (dc->it_cls, address, expiration); |
472 | return ret; | 472 | return ret; |
@@ -609,12 +609,12 @@ find_other_matching (void *cls, const struct GNUNET_HELLO_Address *address, | |||
609 | { | 609 | { |
610 | struct EqualsContext *ec = cls; | 610 | struct EqualsContext *ec = cls; |
611 | 611 | ||
612 | if (expiration.abs_value < ec->expiration_limit.abs_value) | 612 | if (expiration.abs_value_us < ec->expiration_limit.abs_value_us) |
613 | return GNUNET_YES; | 613 | return GNUNET_YES; |
614 | if (0 == GNUNET_HELLO_address_cmp (address, ec->address)) | 614 | if (0 == GNUNET_HELLO_address_cmp (address, ec->address)) |
615 | { | 615 | { |
616 | ec->found = GNUNET_YES; | 616 | ec->found = GNUNET_YES; |
617 | if (expiration.abs_value < ec->expiration.abs_value) | 617 | if (expiration.abs_value_us < ec->expiration.abs_value_us) |
618 | ec->result = GNUNET_TIME_absolute_min (expiration, ec->result); | 618 | ec->result = GNUNET_TIME_absolute_min (expiration, ec->result); |
619 | return GNUNET_SYSERR; | 619 | return GNUNET_SYSERR; |
620 | } | 620 | } |
@@ -628,7 +628,7 @@ find_matching (void *cls, const struct GNUNET_HELLO_Address *address, | |||
628 | { | 628 | { |
629 | struct EqualsContext *ec = cls; | 629 | struct EqualsContext *ec = cls; |
630 | 630 | ||
631 | if (expiration.abs_value < ec->expiration_limit.abs_value) | 631 | if (expiration.abs_value_us < ec->expiration_limit.abs_value_us) |
632 | return GNUNET_YES; | 632 | return GNUNET_YES; |
633 | ec->address = address; | 633 | ec->address = address; |
634 | ec->expiration = expiration; | 634 | ec->expiration = expiration; |
@@ -677,7 +677,7 @@ GNUNET_HELLO_equals (const struct GNUNET_HELLO_Message *h1, | |||
677 | ec.result = GNUNET_TIME_UNIT_FOREVER_ABS; | 677 | ec.result = GNUNET_TIME_UNIT_FOREVER_ABS; |
678 | ec.h2 = h2; | 678 | ec.h2 = h2; |
679 | GNUNET_HELLO_iterate_addresses (h1, GNUNET_NO, &find_matching, &ec); | 679 | GNUNET_HELLO_iterate_addresses (h1, GNUNET_NO, &find_matching, &ec); |
680 | if (ec.result.abs_value == GNUNET_TIME_UNIT_ZERO.rel_value) | 680 | if (ec.result.abs_value_us == GNUNET_TIME_UNIT_ZERO.rel_value_us) |
681 | return ec.result; | 681 | return ec.result; |
682 | ec.h2 = h1; | 682 | ec.h2 = h1; |
683 | GNUNET_HELLO_iterate_addresses (h2, GNUNET_NO, &find_matching, &ec); | 683 | GNUNET_HELLO_iterate_addresses (h2, GNUNET_NO, &find_matching, &ec); |
@@ -707,7 +707,7 @@ GNUNET_HELLO_get_last_expiration (const struct GNUNET_HELLO_Message *msg) | |||
707 | { | 707 | { |
708 | struct GNUNET_TIME_Absolute ret; | 708 | struct GNUNET_TIME_Absolute ret; |
709 | 709 | ||
710 | ret.abs_value = 0; | 710 | ret.abs_value_us = 0; |
711 | GNUNET_HELLO_iterate_addresses (msg, GNUNET_NO, &find_min_expire, &ret); | 711 | GNUNET_HELLO_iterate_addresses (msg, GNUNET_NO, &find_min_expire, &ret); |
712 | return ret; | 712 | return ret; |
713 | } | 713 | } |
@@ -843,7 +843,7 @@ add_address_to_uri (void *cls, const struct GNUNET_HELLO_Address *address, | |||
843 | characters in URIs */ | 843 | characters in URIs */ |
844 | uri_addr = map_characters (addr_dup, "[]", "()"); | 844 | uri_addr = map_characters (addr_dup, "[]", "()"); |
845 | GNUNET_free (addr_dup); | 845 | GNUNET_free (addr_dup); |
846 | seconds = expiration.abs_value / 1000; | 846 | seconds = expiration.abs_value_us / 1000LL / 1000LL; |
847 | t = gmtime (&seconds); | 847 | t = gmtime (&seconds); |
848 | 848 | ||
849 | GNUNET_asprintf (&ret, | 849 | GNUNET_asprintf (&ret, |
@@ -956,7 +956,7 @@ add_address_to_hello (void *cls, size_t max, void *buffer) | |||
956 | GNUNET_break (0); | 956 | GNUNET_break (0); |
957 | return 0; | 957 | return 0; |
958 | } | 958 | } |
959 | expire.abs_value = expiration_seconds * 1000; | 959 | expire.abs_value_us = expiration_seconds * 1000LL * 1000LL; |
960 | } | 960 | } |
961 | if ('!' != tname[0]) | 961 | if ('!' != tname[0]) |
962 | { | 962 | { |
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); |
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c index 84ecb8765..f4ef81f68 100644 --- a/src/identity/identity_api.c +++ b/src/identity/identity_api.c | |||
@@ -186,7 +186,7 @@ GNUNET_IDENTITY_ego_get_anonymous () | |||
186 | 186 | ||
187 | if (NULL != anon.pk) | 187 | if (NULL != anon.pk) |
188 | return &anon; | 188 | return &anon; |
189 | anon.pk = GNUNET_CRYPTO_ecc_key_get_anonymous (); | 189 | anon.pk = (struct GNUNET_CRYPTO_EccPrivateKey *) GNUNET_CRYPTO_ecc_key_get_anonymous (); |
190 | GNUNET_CRYPTO_ecc_key_get_public (anon.pk, | 190 | GNUNET_CRYPTO_ecc_key_get_public (anon.pk, |
191 | &pub); | 191 | &pub); |
192 | GNUNET_CRYPTO_hash (&pub, sizeof (pub), &anon.id); | 192 | GNUNET_CRYPTO_hash (&pub, sizeof (pub), &anon.id); |
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h index bc5148de9..9a4bb6d6b 100644 --- a/src/include/gnunet_ats_service.h +++ b/src/include/gnunet_ats_service.h | |||
@@ -133,7 +133,7 @@ enum GNUNET_ATS_Property | |||
133 | * Delay | 133 | * Delay |
134 | * Time between when the time packet is sent and the packet arrives | 134 | * Time between when the time packet is sent and the packet arrives |
135 | * | 135 | * |
136 | * Unit: [ms] | 136 | * Unit: [microseconds] |
137 | * | 137 | * |
138 | * Examples: | 138 | * Examples: |
139 | * | 139 | * |
@@ -905,8 +905,8 @@ enum GNUNET_ATS_PreferenceKind | |||
905 | * Change the peer's latency value to the given amount. The | 905 | * Change the peer's latency value to the given amount. The |
906 | * argument is followed by a double value giving the desired value | 906 | * argument is followed by a double value giving the desired value |
907 | * (can be negative). The absolute score in the goal function is | 907 | * (can be negative). The absolute score in the goal function is |
908 | * the inverse of the latency in ms (minimum: 1 ms) multiplied by | 908 | * the inverse of the latency in microseconds (minimum: 1 |
909 | * the latency preferences. | 909 | * microsecond) multiplied by the latency preferences. |
910 | */ | 910 | */ |
911 | GNUNET_ATS_PREFERENCE_LATENCY | 911 | GNUNET_ATS_PREFERENCE_LATENCY |
912 | }; | 912 | }; |
diff --git a/src/include/gnunet_client_lib.h b/src/include/gnunet_client_lib.h index e402b4295..5bfc4991f 100644 --- a/src/include/gnunet_client_lib.h +++ b/src/include/gnunet_client_lib.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2013 Christian Grothoff (and other contributing authors) | 3 | (C) 2001-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
diff --git a/src/include/gnunet_resolver_service.h b/src/include/gnunet_resolver_service.h index 498400dc3..f7e5c3b72 100644 --- a/src/include/gnunet_resolver_service.h +++ b/src/include/gnunet_resolver_service.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2001-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h index 1e2a4000a..c482a000c 100644 --- a/src/include/gnunet_scheduler_lib.h +++ b/src/include/gnunet_scheduler_lib.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2009, 2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2009-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
diff --git a/src/include/gnunet_server_lib.h b/src/include/gnunet_server_lib.h index 2c64b4698..6ed862fc7 100644 --- a/src/include/gnunet_server_lib.h +++ b/src/include/gnunet_server_lib.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009, 2010 Christian Grothoff (and other contributing authors) | 3 | (C) 2009-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h index 450417730..298f3284a 100644 --- a/src/include/gnunet_time_lib.h +++ b/src/include/gnunet_time_lib.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2001-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -39,18 +39,18 @@ extern "C" | |||
39 | #include "gnunet_common.h" | 39 | #include "gnunet_common.h" |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * Time for absolute times used by GNUnet, in milliseconds. | 42 | * Time for absolute times used by GNUnet, in microseconds. |
43 | */ | 43 | */ |
44 | struct GNUNET_TIME_Absolute | 44 | struct GNUNET_TIME_Absolute |
45 | { | 45 | { |
46 | /** | 46 | /** |
47 | * The actual value. | 47 | * The actual value. |
48 | */ | 48 | */ |
49 | uint64_t abs_value; | 49 | uint64_t abs_value_us; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Time for relative time used by GNUnet, in milliseconds. | 53 | * Time for relative time used by GNUnet, in microseconds. |
54 | * Always positive, so we can only refer to future time. | 54 | * Always positive, so we can only refer to future time. |
55 | */ | 55 | */ |
56 | struct GNUNET_TIME_Relative | 56 | struct GNUNET_TIME_Relative |
@@ -58,32 +58,32 @@ struct GNUNET_TIME_Relative | |||
58 | /** | 58 | /** |
59 | * The actual value. | 59 | * The actual value. |
60 | */ | 60 | */ |
61 | uint64_t rel_value; | 61 | uint64_t rel_value_us; |
62 | }; | 62 | }; |
63 | 63 | ||
64 | GNUNET_NETWORK_STRUCT_BEGIN | 64 | GNUNET_NETWORK_STRUCT_BEGIN |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * Time for relative time used by GNUnet, in milliseconds and in network byte order. | 67 | * Time for relative time used by GNUnet, in microseconds and in network byte order. |
68 | */ | 68 | */ |
69 | struct GNUNET_TIME_RelativeNBO | 69 | struct GNUNET_TIME_RelativeNBO |
70 | { | 70 | { |
71 | /** | 71 | /** |
72 | * The actual value (in network byte order). | 72 | * The actual value (in network byte order). |
73 | */ | 73 | */ |
74 | uint64_t rel_value__ GNUNET_PACKED; | 74 | uint64_t rel_value_us__ GNUNET_PACKED; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | 77 | ||
78 | /** | 78 | /** |
79 | * Time for absolute time used by GNUnet, in milliseconds and in network byte order. | 79 | * Time for absolute time used by GNUnet, in microseconds and in network byte order. |
80 | */ | 80 | */ |
81 | struct GNUNET_TIME_AbsoluteNBO | 81 | struct GNUNET_TIME_AbsoluteNBO |
82 | { | 82 | { |
83 | /** | 83 | /** |
84 | * The actual value (in network byte order). | 84 | * The actual value (in network byte order). |
85 | */ | 85 | */ |
86 | uint64_t abs_value__ GNUNET_PACKED; | 86 | uint64_t abs_value_us__ GNUNET_PACKED; |
87 | }; | 87 | }; |
88 | GNUNET_NETWORK_STRUCT_END | 88 | GNUNET_NETWORK_STRUCT_END |
89 | 89 | ||
@@ -98,9 +98,14 @@ GNUNET_NETWORK_STRUCT_END | |||
98 | #define GNUNET_TIME_UNIT_ZERO_ABS GNUNET_TIME_absolute_get_zero_() | 98 | #define GNUNET_TIME_UNIT_ZERO_ABS GNUNET_TIME_absolute_get_zero_() |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * One millisecond, our basic time unit. | 101 | * One microsecond, our basic time unit. |
102 | */ | 102 | */ |
103 | #define GNUNET_TIME_UNIT_MILLISECONDS GNUNET_TIME_relative_get_unit_() | 103 | #define GNUNET_TIME_UNIT_MICROSECONDS GNUNET_TIME_relative_get_unit_() |
104 | |||
105 | /** | ||
106 | * One millisecond. | ||
107 | */ | ||
108 | #define GNUNET_TIME_UNIT_MILLISECONDS GNUNET_TIME_relative_get_millisecond_() | ||
104 | 109 | ||
105 | /** | 110 | /** |
106 | * One second. | 111 | * One second. |
@@ -181,13 +186,20 @@ GNUNET_TIME_absolute_get_zero_ (void); | |||
181 | 186 | ||
182 | 187 | ||
183 | /** | 188 | /** |
184 | * Return relative time of 1ms. | 189 | * Return relative time of 1 microsecond. |
185 | */ | 190 | */ |
186 | struct GNUNET_TIME_Relative | 191 | struct GNUNET_TIME_Relative |
187 | GNUNET_TIME_relative_get_unit_ (void); | 192 | GNUNET_TIME_relative_get_unit_ (void); |
188 | 193 | ||
189 | 194 | ||
190 | /** | 195 | /** |
196 | * Return relative time of 1ms. | ||
197 | */ | ||
198 | struct GNUNET_TIME_Relative | ||
199 | GNUNET_TIME_relative_get_millisecond_ (void); | ||
200 | |||
201 | |||
202 | /** | ||
191 | * Return relative time of 1s. | 203 | * Return relative time of 1s. |
192 | */ | 204 | */ |
193 | struct GNUNET_TIME_Relative | 205 | struct GNUNET_TIME_Relative |
diff --git a/src/mesh/gnunet-service-mesh-enc.c b/src/mesh/gnunet-service-mesh-enc.c index 6005e22db..23d851287 100644 --- a/src/mesh/gnunet-service-mesh-enc.c +++ b/src/mesh/gnunet-service-mesh-enc.c | |||
@@ -1926,8 +1926,8 @@ peer_get_oldest (void *cls, | |||
1926 | if (GNUNET_YES == peer_is_used (p)) | 1926 | if (GNUNET_YES == peer_is_used (p)) |
1927 | return GNUNET_YES; | 1927 | return GNUNET_YES; |
1928 | 1928 | ||
1929 | if (abs->abs_value < p->last_contact.abs_value) | 1929 | if (abs->abs_value_us < p->last_contact.abs_value_us) |
1930 | abs->abs_value = p->last_contact.abs_value; | 1930 | abs->abs_value_us = p->last_contact.abs_value_us; |
1931 | 1931 | ||
1932 | return GNUNET_YES; | 1932 | return GNUNET_YES; |
1933 | } | 1933 | } |
@@ -1948,7 +1948,7 @@ peer_timeout (void *cls, | |||
1948 | struct MeshPeer *p = value; | 1948 | struct MeshPeer *p = value; |
1949 | struct GNUNET_TIME_Absolute *abs = cls; | 1949 | struct GNUNET_TIME_Absolute *abs = cls; |
1950 | 1950 | ||
1951 | if (p->last_contact.abs_value == abs->abs_value && | 1951 | if (p->last_contact.abs_value_us == abs->abs_value_us && |
1952 | GNUNET_NO == peer_is_used (p)) | 1952 | GNUNET_NO == peer_is_used (p)) |
1953 | { | 1953 | { |
1954 | peer_destroy (p); | 1954 | peer_destroy (p); |
@@ -3199,9 +3199,9 @@ rel_message_free (struct MeshReliableMessage *copy) | |||
3199 | 3199 | ||
3200 | rel = copy->rel; | 3200 | rel = copy->rel; |
3201 | time = GNUNET_TIME_absolute_get_duration (copy->timestamp); | 3201 | time = GNUNET_TIME_absolute_get_duration (copy->timestamp); |
3202 | rel->expected_delay.rel_value *= 7; | 3202 | rel->expected_delay.rel_value_us *= 7; |
3203 | rel->expected_delay.rel_value += time.rel_value; | 3203 | rel->expected_delay.rel_value_us += time.rel_value_us; |
3204 | rel->expected_delay.rel_value /= 8; | 3204 | rel->expected_delay.rel_value_us /= 8; |
3205 | rel->n_sent--; | 3205 | rel->n_sent--; |
3206 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Freeing %u\n", copy->mid); | 3206 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Freeing %u\n", copy->mid); |
3207 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " n_sent %u\n", rel->n_sent); | 3207 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " n_sent %u\n", rel->n_sent); |
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 0dfac410d..9b4e4ad72 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -2709,9 +2709,9 @@ tunnel_free_reliable_message (struct MeshReliableMessage *copy) | |||
2709 | 2709 | ||
2710 | rel = copy->rel; | 2710 | rel = copy->rel; |
2711 | time = GNUNET_TIME_absolute_get_duration (copy->timestamp); | 2711 | time = GNUNET_TIME_absolute_get_duration (copy->timestamp); |
2712 | rel->expected_delay.rel_value *= 7; | 2712 | rel->expected_delay.rel_value_us *= 7; |
2713 | rel->expected_delay.rel_value += time.rel_value; | 2713 | rel->expected_delay.rel_value_us += time.rel_value_us; |
2714 | rel->expected_delay.rel_value /= 8; | 2714 | rel->expected_delay.rel_value_us /= 8; |
2715 | rel->n_sent--; | 2715 | rel->n_sent--; |
2716 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Freeing %u\n", copy->mid); | 2716 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Freeing %u\n", copy->mid); |
2717 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " n_sent %u\n", rel->n_sent); | 2717 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " n_sent %u\n", rel->n_sent); |
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index 5daad36e2..1beebf9c1 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c | |||
@@ -564,7 +564,7 @@ add_to_queue (struct GNUNET_MESH_Handle *h, | |||
564 | struct GNUNET_MESH_TransmitHandle *th) | 564 | struct GNUNET_MESH_TransmitHandle *th) |
565 | { | 565 | { |
566 | GNUNET_CONTAINER_DLL_insert_tail (h->th_head, h->th_tail, th); | 566 | GNUNET_CONTAINER_DLL_insert_tail (h->th_head, h->th_tail, th); |
567 | if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value == th->timeout.abs_value) | 567 | if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us == th->timeout.abs_value_us) |
568 | return; | 568 | return; |
569 | th->timeout_task = | 569 | th->timeout_task = |
570 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining | 570 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining |
diff --git a/src/mesh/mesh_api_enc.c b/src/mesh/mesh_api_enc.c index 3401f5d33..113ff46d0 100644 --- a/src/mesh/mesh_api_enc.c +++ b/src/mesh/mesh_api_enc.c | |||
@@ -551,7 +551,7 @@ add_to_queue (struct GNUNET_MESH_Handle *h, | |||
551 | struct GNUNET_MESH_TransmitHandle *th) | 551 | struct GNUNET_MESH_TransmitHandle *th) |
552 | { | 552 | { |
553 | GNUNET_CONTAINER_DLL_insert_tail (h->th_head, h->th_tail, th); | 553 | GNUNET_CONTAINER_DLL_insert_tail (h->th_head, h->th_tail, th); |
554 | if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value == th->timeout.abs_value) | 554 | if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us == th->timeout.abs_value_us) |
555 | return; | 555 | return; |
556 | th->timeout_task = | 556 | th->timeout_task = |
557 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining | 557 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining |
diff --git a/src/mesh/test_mesh_small.c b/src/mesh/test_mesh_small.c index 30ea49223..dc9f9461c 100644 --- a/src/mesh/test_mesh_small.c +++ b/src/mesh/test_mesh_small.c | |||
@@ -192,14 +192,15 @@ show_end_data (void) | |||
192 | end_time = GNUNET_TIME_absolute_get(); | 192 | end_time = GNUNET_TIME_absolute_get(); |
193 | total_time = GNUNET_TIME_absolute_get_difference(start_time, end_time); | 193 | total_time = GNUNET_TIME_absolute_get_difference(start_time, end_time); |
194 | FPRINTF (stderr, "\nResults of test \"%s\"\n", test_name); | 194 | FPRINTF (stderr, "\nResults of test \"%s\"\n", test_name); |
195 | FPRINTF (stderr, "Test time %llu ms\n", | 195 | FPRINTF (stderr, "Test time %s\n", |
196 | (unsigned long long) total_time.rel_value); | 196 | GNUNET_STRINGS_relative_time_to_string (total_time, |
197 | GNUNET_YES)); | ||
197 | FPRINTF (stderr, "Test bandwidth: %f kb/s\n", | 198 | FPRINTF (stderr, "Test bandwidth: %f kb/s\n", |
198 | 4 * TOTAL_PACKETS * 1.0 / total_time.rel_value); // 4bytes * ms | 199 | 4 * TOTAL_PACKETS * 1.0 / (total_time.rel_value_us / 1000)); // 4bytes * ms |
199 | FPRINTF (stderr, "Test throughput: %f packets/s\n\n", | 200 | FPRINTF (stderr, "Test throughput: %f packets/s\n\n", |
200 | TOTAL_PACKETS * 1000.0 / total_time.rel_value); // packets * ms | 201 | TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000)); // packets * ms |
201 | GAUGER ("MESH", test_name, | 202 | GAUGER ("MESH", test_name, |
202 | TOTAL_PACKETS * 1000.0 / total_time.rel_value, | 203 | TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000), |
203 | "packets/s"); | 204 | "packets/s"); |
204 | } | 205 | } |
205 | 206 | ||
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index 50a8601f8..d0f68b78e 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c | |||
@@ -345,12 +345,12 @@ display_record (void *cls, | |||
345 | } | 345 | } |
346 | if (0 != (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) | 346 | if (0 != (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) |
347 | { | 347 | { |
348 | rex.rel_value = rd[i].expiration_time; | 348 | rex.rel_value_us = rd[i].expiration_time; |
349 | etime = GNUNET_STRINGS_relative_time_to_string (rex, GNUNET_YES); | 349 | etime = GNUNET_STRINGS_relative_time_to_string (rex, GNUNET_YES); |
350 | } | 350 | } |
351 | else | 351 | else |
352 | { | 352 | { |
353 | aex.abs_value = rd[i].expiration_time; | 353 | aex.abs_value_us = rd[i].expiration_time; |
354 | etime = GNUNET_STRINGS_absolute_time_to_string (aex); | 354 | etime = GNUNET_STRINGS_absolute_time_to_string (aex); |
355 | } | 355 | } |
356 | FPRINTF (stdout, "\t%s: %s (%s %s)\n", typestring, s, | 356 | FPRINTF (stdout, "\t%s: %s (%s %s)\n", typestring, s, |
@@ -418,12 +418,12 @@ get_existing_record (void *cls, | |||
418 | rde->record_type = type; | 418 | rde->record_type = type; |
419 | if (GNUNET_YES == etime_is_rel) | 419 | if (GNUNET_YES == etime_is_rel) |
420 | { | 420 | { |
421 | rde->expiration_time = etime_rel.rel_value; | 421 | rde->expiration_time = etime_rel.rel_value_us; |
422 | rde->flags |= GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION; | 422 | rde->flags |= GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION; |
423 | } | 423 | } |
424 | else if (GNUNET_NO == etime_is_rel) | 424 | else if (GNUNET_NO == etime_is_rel) |
425 | { | 425 | { |
426 | rde->expiration_time = etime_abs.abs_value; | 426 | rde->expiration_time = etime_abs.abs_value_us; |
427 | } | 427 | } |
428 | if (1 != nonauthority) | 428 | if (1 != nonauthority) |
429 | rde->flags |= GNUNET_NAMESTORE_RF_AUTHORITY; | 429 | rde->flags |= GNUNET_NAMESTORE_RF_AUTHORITY; |
@@ -658,13 +658,13 @@ testservice_task (void *cls, | |||
658 | rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; | 658 | rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; |
659 | if (GNUNET_YES == etime_is_rel) | 659 | if (GNUNET_YES == etime_is_rel) |
660 | { | 660 | { |
661 | rd.expiration_time = etime_rel.rel_value; | 661 | rd.expiration_time = etime_rel.rel_value_us; |
662 | rd.flags |= GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION; | 662 | rd.flags |= GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION; |
663 | } | 663 | } |
664 | else if (GNUNET_NO == etime_is_rel) | 664 | else if (GNUNET_NO == etime_is_rel) |
665 | rd.expiration_time = etime_abs.abs_value; | 665 | rd.expiration_time = etime_abs.abs_value_us; |
666 | else | 666 | else |
667 | rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value; | 667 | rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; |
668 | if (1 != nonauthority) | 668 | if (1 != nonauthority) |
669 | rd.flags |= GNUNET_NAMESTORE_RF_AUTHORITY; | 669 | rd.flags |= GNUNET_NAMESTORE_RF_AUTHORITY; |
670 | add_qe_uri = GNUNET_NAMESTORE_record_put_by_authority (ns, | 670 | add_qe_uri = GNUNET_NAMESTORE_record_put_by_authority (ns, |
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index a4e463642..749552dca 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -442,12 +442,12 @@ get_block_expiration_time (unsigned int rd_count, const struct GNUNET_NAMESTORE_ | |||
442 | { | 442 | { |
443 | if (0 != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) | 443 | if (0 != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) |
444 | { | 444 | { |
445 | rt.rel_value = rd[c].expiration_time; | 445 | rt.rel_value_us = rd[c].expiration_time; |
446 | at = GNUNET_TIME_relative_to_absolute (rt); | 446 | at = GNUNET_TIME_relative_to_absolute (rt); |
447 | } | 447 | } |
448 | else | 448 | else |
449 | { | 449 | { |
450 | at.abs_value = rd[c].expiration_time; | 450 | at.abs_value_us = rd[c].expiration_time; |
451 | } | 451 | } |
452 | expire = GNUNET_TIME_absolute_min (at, expire); | 452 | expire = GNUNET_TIME_absolute_min (at, expire); |
453 | } | 453 | } |
@@ -742,16 +742,16 @@ handle_lookup_name_it (void *cls, | |||
742 | { | 742 | { |
743 | GNUNET_break (GNUNET_YES == authoritative); | 743 | GNUNET_break (GNUNET_YES == authoritative); |
744 | rd_modified = GNUNET_YES; | 744 | rd_modified = GNUNET_YES; |
745 | re.rel_value = rd[c].expiration_time; | 745 | re.rel_value_us = rd[c].expiration_time; |
746 | e = GNUNET_TIME_relative_to_absolute (re); | 746 | e = GNUNET_TIME_relative_to_absolute (re); |
747 | } | 747 | } |
748 | else | 748 | else |
749 | { | 749 | { |
750 | e.abs_value = rd[c].expiration_time; | 750 | e.abs_value_us = rd[c].expiration_time; |
751 | } | 751 | } |
752 | /* found matching record, copy and convert flags to public format */ | 752 | /* found matching record, copy and convert flags to public format */ |
753 | rd_selected[copied_elements] = rd[c]; /* shallow copy! */ | 753 | rd_selected[copied_elements] = rd[c]; /* shallow copy! */ |
754 | rd_selected[copied_elements].expiration_time = e.abs_value; | 754 | rd_selected[copied_elements].expiration_time = e.abs_value_us; |
755 | if (0 != (rd_selected[copied_elements].flags & | 755 | if (0 != (rd_selected[copied_elements].flags & |
756 | (GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION | GNUNET_NAMESTORE_RF_AUTHORITY))) | 756 | (GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION | GNUNET_NAMESTORE_RF_AUTHORITY))) |
757 | { | 757 | { |
@@ -1609,8 +1609,8 @@ zone_iteraterate_proc (void *cls, | |||
1609 | (0 != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) ) | 1609 | (0 != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) ) |
1610 | { | 1610 | { |
1611 | /* should convert relative-to-absolute expiration time */ | 1611 | /* should convert relative-to-absolute expiration time */ |
1612 | rt.rel_value = rd[c].expiration_time; | 1612 | rt.rel_value_us = rd[c].expiration_time; |
1613 | rd_filtered[c].expiration_time = GNUNET_TIME_relative_to_absolute (rt).abs_value; | 1613 | rd_filtered[c].expiration_time = GNUNET_TIME_relative_to_absolute (rt).abs_value_us; |
1614 | rd_filtered[c].flags &= ~ GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION; | 1614 | rd_filtered[c].flags &= ~ GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION; |
1615 | } | 1615 | } |
1616 | /* we NEVER keep the 'authority' flag */ | 1616 | /* we NEVER keep the 'authority' flag */ |
@@ -1637,10 +1637,10 @@ zone_iteraterate_proc (void *cls, | |||
1637 | 1637 | ||
1638 | 1638 | ||
1639 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1639 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1640 | "Creating signature for `%s' in zone `%s' with %u records and expiration %llu\n", | 1640 | "Creating signature for `%s' in zone `%s' with %u records and expiration %s\n", |
1641 | name, GNUNET_NAMESTORE_short_h2s(&zone_hash), | 1641 | name, GNUNET_NAMESTORE_short_h2s(&zone_hash), |
1642 | rd_count_filtered, | 1642 | rd_count_filtered, |
1643 | (unsigned long long) expire.abs_value); | 1643 | GNUNET_STRINGS_absolute_time_to_string (expire)); |
1644 | /* TODO 1) AB: New publishing | 1644 | /* TODO 1) AB: New publishing |
1645 | * - Create HDKF(Q,i) | 1645 | * - Create HDKF(Q,i) |
1646 | * - Encrypt record block R with HKDF: HDKF(Q,i) == E(R) | 1646 | * - Encrypt record block R with HKDF: HDKF(Q,i) == E(R) |
@@ -1671,9 +1671,9 @@ zone_iteraterate_proc (void *cls, | |||
1671 | if (NULL != signature) | 1671 | if (NULL != signature) |
1672 | { | 1672 | { |
1673 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1673 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1674 | "Using provided signature for `%s' in zone `%s' with %u records and expiration %llu\n", | 1674 | "Using provided signature for `%s' in zone `%s' with %u records and expiration %s\n", |
1675 | name, GNUNET_NAMESTORE_short_h2s (&zone_hash), rd_count_filtered, | 1675 | name, GNUNET_NAMESTORE_short_h2s (&zone_hash), rd_count_filtered, |
1676 | (unsigned long long) expire.abs_value); | 1676 | GNUNET_STRINGS_absolute_time_to_string (expire)); |
1677 | return; | 1677 | return; |
1678 | } | 1678 | } |
1679 | } | 1679 | } |
diff --git a/src/namestore/namestore_api_common.c b/src/namestore/namestore_api_common.c index d8fede7d2..7098e6131 100644 --- a/src/namestore/namestore_api_common.c +++ b/src/namestore/namestore_api_common.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009, 2010, 2012 Christian Grothoff (and other contributing authors) | 3 | (C) 2009-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -747,8 +747,8 @@ GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd) | |||
747 | 747 | ||
748 | if (0 != (rd->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) | 748 | if (0 != (rd->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) |
749 | return GNUNET_NO; | 749 | return GNUNET_NO; |
750 | at.abs_value = rd->expiration_time; | 750 | at.abs_value_us = rd->expiration_time; |
751 | return (0 == GNUNET_TIME_absolute_get_remaining (at).rel_value) ? GNUNET_YES : GNUNET_NO; | 751 | return (0 == GNUNET_TIME_absolute_get_remaining (at).rel_value_us) ? GNUNET_YES : GNUNET_NO; |
752 | } | 752 | } |
753 | 753 | ||
754 | 754 | ||
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c index 64bfa631c..b62c306f3 100644 --- a/src/namestore/plugin_namestore_postgres.c +++ b/src/namestore/plugin_namestore_postgres.c | |||
@@ -311,7 +311,7 @@ namestore_postgres_put_records (void *cls, | |||
311 | } | 311 | } |
312 | { | 312 | { |
313 | char data[data_size]; | 313 | char data[data_size]; |
314 | uint64_t expire_be = GNUNET_htonll (expire.abs_value); | 314 | uint64_t expire_be = GNUNET_htonll (expire.abs_value_us); |
315 | uint64_t rvalue_be = GNUNET_htonll (rvalue); | 315 | uint64_t rvalue_be = GNUNET_htonll (rvalue); |
316 | uint32_t rd_count_be = htonl ((uint32_t) rd_count); | 316 | uint32_t rd_count_be = htonl ((uint32_t) rd_count); |
317 | const char *paramValues[] = { | 317 | const char *paramValues[] = { |
@@ -421,7 +421,7 @@ get_record_and_call_iterator (struct Plugin *plugin, | |||
421 | record_count = ntohl (*(uint32_t *) PQgetvalue (res, 0, 2)); | 421 | record_count = ntohl (*(uint32_t *) PQgetvalue (res, 0, 2)); |
422 | data_size = PQgetlength (res, 0, 3); | 422 | data_size = PQgetlength (res, 0, 3); |
423 | data = PQgetvalue (res, 0, 3); | 423 | data = PQgetvalue (res, 0, 3); |
424 | expiration.abs_value = | 424 | expiration.abs_value_us = |
425 | GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0, 4)); | 425 | GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0, 4)); |
426 | sig = (const struct GNUNET_CRYPTO_EccSignature*) PQgetvalue (res, 0, 5); | 426 | sig = (const struct GNUNET_CRYPTO_EccSignature*) PQgetvalue (res, 0, 5); |
427 | if (record_count > 64 * 1024) | 427 | if (record_count > 64 * 1024) |
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c index 6ee3de495..a7cc03434 100644 --- a/src/namestore/plugin_namestore_sqlite.c +++ b/src/namestore/plugin_namestore_sqlite.c | |||
@@ -501,7 +501,7 @@ namestore_sqlite_put_records (void *cls, | |||
501 | (SQLITE_OK != sqlite3_bind_text (plugin->put_records, 2, name, -1, SQLITE_STATIC)) || | 501 | (SQLITE_OK != sqlite3_bind_text (plugin->put_records, 2, name, -1, SQLITE_STATIC)) || |
502 | (SQLITE_OK != sqlite3_bind_int (plugin->put_records, 3, rd_count)) || | 502 | (SQLITE_OK != sqlite3_bind_int (plugin->put_records, 3, rd_count)) || |
503 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 4, data, data_size, SQLITE_STATIC)) || | 503 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 4, data, data_size, SQLITE_STATIC)) || |
504 | (SQLITE_OK != sqlite3_bind_int64 (plugin->put_records, 5, expire.abs_value)) || | 504 | (SQLITE_OK != sqlite3_bind_int64 (plugin->put_records, 5, expire.abs_value_us)) || |
505 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 6, signature, sizeof (struct GNUNET_CRYPTO_EccSignature), SQLITE_STATIC)) || | 505 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 6, signature, sizeof (struct GNUNET_CRYPTO_EccSignature), SQLITE_STATIC)) || |
506 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 7, &zone_delegation, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) || | 506 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 7, &zone_delegation, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) || |
507 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 8, &zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) || | 507 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 8, &zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) || |
@@ -575,7 +575,7 @@ get_record_and_call_iterator (struct Plugin *plugin, | |||
575 | record_count = sqlite3_column_int (stmt, 2); | 575 | record_count = sqlite3_column_int (stmt, 2); |
576 | data_size = sqlite3_column_bytes (stmt, 3); | 576 | data_size = sqlite3_column_bytes (stmt, 3); |
577 | data = sqlite3_column_blob (stmt, 3); | 577 | data = sqlite3_column_blob (stmt, 3); |
578 | expiration.abs_value = (uint64_t) sqlite3_column_int64 (stmt, 4); | 578 | expiration.abs_value_us = (uint64_t) sqlite3_column_int64 (stmt, 4); |
579 | sig = sqlite3_column_blob (stmt, 5); | 579 | sig = sqlite3_column_blob (stmt, 5); |
580 | 580 | ||
581 | if ( (sizeof (struct GNUNET_CRYPTO_EccPublicKey) != sqlite3_column_bytes (stmt, 0)) || | 581 | if ( (sizeof (struct GNUNET_CRYPTO_EccPublicKey) != sqlite3_column_bytes (stmt, 0)) || |
diff --git a/src/namestore/test_namestore_api.c b/src/namestore/test_namestore_api.c index 3397b35f1..3d921f132 100644 --- a/src/namestore/test_namestore_api.c +++ b/src/namestore/test_namestore_api.c | |||
@@ -153,7 +153,7 @@ run (void *cls, | |||
153 | GNUNET_CRYPTO_ecc_key_get_public (privkey, &pubkey); | 153 | GNUNET_CRYPTO_ecc_key_get_public (privkey, &pubkey); |
154 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (pubkey), &zone); | 154 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (pubkey), &zone); |
155 | memset (&signature, '\0', sizeof (signature)); | 155 | memset (&signature, '\0', sizeof (signature)); |
156 | rd.expiration_time = GNUNET_TIME_absolute_get().abs_value; | 156 | rd.expiration_time = GNUNET_TIME_absolute_get().abs_value_us; |
157 | rd.record_type = TEST_RECORD_TYPE; | 157 | rd.record_type = TEST_RECORD_TYPE; |
158 | rd.data_size = TEST_RECORD_DATALEN; | 158 | rd.data_size = TEST_RECORD_DATALEN; |
159 | rd.data = GNUNET_malloc (TEST_RECORD_DATALEN); | 159 | rd.data = GNUNET_malloc (TEST_RECORD_DATALEN); |
diff --git a/src/namestore/test_namestore_api_create.c b/src/namestore/test_namestore_api_create.c index 4eac96df6..667bf0827 100644 --- a/src/namestore/test_namestore_api_create.c +++ b/src/namestore/test_namestore_api_create.c | |||
@@ -316,7 +316,7 @@ create_record (unsigned int count) | |||
316 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 316 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
317 | for (c = 0; c < count; c++) | 317 | for (c = 0; c < count; c++) |
318 | { | 318 | { |
319 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; | 319 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
320 | rd[c].record_type = TEST_RECORD_TYPE; | 320 | rd[c].record_type = TEST_RECORD_TYPE; |
321 | rd[c].data_size = TEST_RECORD_DATALEN; | 321 | rd[c].data_size = TEST_RECORD_DATALEN; |
322 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); | 322 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); |
diff --git a/src/namestore/test_namestore_api_create_update.c b/src/namestore/test_namestore_api_create_update.c index f1e66963f..90d36ccb6 100644 --- a/src/namestore/test_namestore_api_create_update.c +++ b/src/namestore/test_namestore_api_create_update.c | |||
@@ -146,7 +146,7 @@ create_identical_cont (void *cls, int32_t success, const char *emsg) | |||
146 | if (success == GNUNET_OK) | 146 | if (success == GNUNET_OK) |
147 | { | 147 | { |
148 | res = 0; | 148 | res = 0; |
149 | s_first_record->expiration_time = GNUNET_TIME_absolute_get ().abs_value; | 149 | s_first_record->expiration_time = GNUNET_TIME_absolute_get ().abs_value_us; |
150 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name, | 150 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name, |
151 | 1, s_first_record, | 151 | 1, s_first_record, |
152 | &create_updated_cont, s_name); | 152 | &create_updated_cont, s_name); |
@@ -239,7 +239,7 @@ run (void *cls, | |||
239 | char rd_ser[rd_ser_len]; | 239 | char rd_ser[rd_ser_len]; |
240 | GNUNET_NAMESTORE_records_serialize(1, s_first_record, rd_ser_len, rd_ser); | 240 | GNUNET_NAMESTORE_records_serialize(1, s_first_record, rd_ser_len, rd_ser); |
241 | 241 | ||
242 | et.abs_value = s_first_record->expiration_time; | 242 | et.abs_value_us = s_first_record->expiration_time; |
243 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_first_record, 1); | 243 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_first_record, 1); |
244 | 244 | ||
245 | /* create random zone hash */ | 245 | /* create random zone hash */ |
diff --git a/src/namestore/test_namestore_api_lookup.c b/src/namestore/test_namestore_api_lookup.c index d8f6fe056..24ef4c74e 100644 --- a/src/namestore/test_namestore_api_lookup.c +++ b/src/namestore/test_namestore_api_lookup.c | |||
@@ -200,7 +200,7 @@ create_record (unsigned int count) | |||
200 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 200 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
201 | for (c = 0; c < count; c++) | 201 | for (c = 0; c < count; c++) |
202 | { | 202 | { |
203 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; | 203 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
204 | rd[c].record_type = TEST_RECORD_TYPE; | 204 | rd[c].record_type = TEST_RECORD_TYPE; |
205 | rd[c].data_size = TEST_RECORD_DATALEN; | 205 | rd[c].data_size = TEST_RECORD_DATALEN; |
206 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); | 206 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); |
@@ -237,7 +237,7 @@ run (void *cls, | |||
237 | GNUNET_NAMESTORE_records_serialize(RECORDS, s_rd, rd_ser_len, rd_ser); | 237 | GNUNET_NAMESTORE_records_serialize(RECORDS, s_rd, rd_ser_len, rd_ser); |
238 | 238 | ||
239 | /* sign */ | 239 | /* sign */ |
240 | et.abs_value = s_rd[0].expiration_time; | 240 | et.abs_value_us = s_rd[0].expiration_time; |
241 | s_signature = GNUNET_NAMESTORE_create_signature (privkey, et, s_name, | 241 | s_signature = GNUNET_NAMESTORE_create_signature (privkey, et, s_name, |
242 | s_rd, RECORDS); | 242 | s_rd, RECORDS); |
243 | 243 | ||
diff --git a/src/namestore/test_namestore_api_lookup_specific_type.c b/src/namestore/test_namestore_api_lookup_specific_type.c index 28632c83f..1d084dbc1 100644 --- a/src/namestore/test_namestore_api_lookup_specific_type.c +++ b/src/namestore/test_namestore_api_lookup_specific_type.c | |||
@@ -250,13 +250,13 @@ create_record (unsigned int count) | |||
250 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 250 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
251 | for (c = 0; c < count-1; c++) | 251 | for (c = 0; c < count-1; c++) |
252 | { | 252 | { |
253 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; | 253 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
254 | rd[c].record_type = 1; | 254 | rd[c].record_type = 1; |
255 | rd[c].data_size = TEST_RECORD_DATALEN; | 255 | rd[c].data_size = TEST_RECORD_DATALEN; |
256 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); | 256 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); |
257 | memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); | 257 | memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); |
258 | } | 258 | } |
259 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; | 259 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
260 | rd[c].record_type = TEST_RECORD_LOOKUP_TYPE_EXISTING; | 260 | rd[c].record_type = TEST_RECORD_LOOKUP_TYPE_EXISTING; |
261 | rd[c].data_size = TEST_RECORD_DATALEN; | 261 | rd[c].data_size = TEST_RECORD_DATALEN; |
262 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); | 262 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); |
@@ -296,7 +296,7 @@ run (void *cls, | |||
296 | GNUNET_NAMESTORE_records_serialize(RECORDS, s_rd, rd_ser_len, rd_ser); | 296 | GNUNET_NAMESTORE_records_serialize(RECORDS, s_rd, rd_ser_len, rd_ser); |
297 | 297 | ||
298 | /* sign */ | 298 | /* sign */ |
299 | et.abs_value = s_rd[RECORDS - 1].expiration_time; | 299 | et.abs_value_us = s_rd[RECORDS - 1].expiration_time; |
300 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_rd, RECORDS); | 300 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_rd, RECORDS); |
301 | 301 | ||
302 | /* create random zone hash */ | 302 | /* create random zone hash */ |
diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c index c103952fa..f60116a79 100644 --- a/src/namestore/test_namestore_api_monitoring.c +++ b/src/namestore/test_namestore_api_monitoring.c | |||
@@ -219,7 +219,7 @@ create_record (unsigned int count) | |||
219 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 219 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
220 | for (c = 0; c < count; c++) | 220 | for (c = 0; c < count; c++) |
221 | { | 221 | { |
222 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; | 222 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
223 | rd[c].record_type = 1111; | 223 | rd[c].record_type = 1111; |
224 | rd[c].data_size = 50; | 224 | rd[c].data_size = 50; |
225 | rd[c].data = GNUNET_malloc(50); | 225 | rd[c].data = GNUNET_malloc(50); |
@@ -282,7 +282,7 @@ run (void *cls, | |||
282 | 282 | ||
283 | GNUNET_asprintf(&s_name_1, "dummy1"); | 283 | GNUNET_asprintf(&s_name_1, "dummy1"); |
284 | s_rd_1 = create_record(1); | 284 | s_rd_1 = create_record(1); |
285 | et.abs_value = s_rd_1->expiration_time; | 285 | et.abs_value_us = s_rd_1->expiration_time; |
286 | sig_1 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_1, s_rd_1, 1); | 286 | sig_1 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_1, s_rd_1, 1); |
287 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_1, | 287 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_1, |
288 | 1, s_rd_1, | 288 | 1, s_rd_1, |
@@ -293,7 +293,7 @@ run (void *cls, | |||
293 | GNUNET_asprintf(&s_name_2, "dummy2"); | 293 | GNUNET_asprintf(&s_name_2, "dummy2"); |
294 | s_rd_2 = create_record(1); | 294 | s_rd_2 = create_record(1); |
295 | 295 | ||
296 | et.abs_value = s_rd_2->expiration_time; | 296 | et.abs_value_us = s_rd_2->expiration_time; |
297 | sig_2 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_2, s_rd_2, 1); | 297 | sig_2 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_2, s_rd_2, 1); |
298 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_2, | 298 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_2, |
299 | 1, s_rd_2, | 299 | 1, s_rd_2, |
@@ -303,7 +303,7 @@ run (void *cls, | |||
303 | /* name in different zone */ | 303 | /* name in different zone */ |
304 | GNUNET_asprintf(&s_name_3, "dummy3"); | 304 | GNUNET_asprintf(&s_name_3, "dummy3"); |
305 | s_rd_3 = create_record(1); | 305 | s_rd_3 = create_record(1); |
306 | et.abs_value = s_rd_3->expiration_time; | 306 | et.abs_value_us = s_rd_3->expiration_time; |
307 | sig_3 = GNUNET_NAMESTORE_create_signature(privkey2, et, s_name_3, s_rd_3, 1); | 307 | sig_3 = GNUNET_NAMESTORE_create_signature(privkey2, et, s_name_3, s_rd_3, 1); |
308 | GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, | 308 | GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, |
309 | GNUNET_TIME_UNIT_FOREVER_ABS, 1, s_rd_3, sig_3, | 309 | GNUNET_TIME_UNIT_FOREVER_ABS, 1, s_rd_3, sig_3, |
diff --git a/src/namestore/test_namestore_api_put.c b/src/namestore/test_namestore_api_put.c index ff99b60f9..ccbe8eefe 100644 --- a/src/namestore/test_namestore_api_put.c +++ b/src/namestore/test_namestore_api_put.c | |||
@@ -121,7 +121,7 @@ create_record (unsigned int count) | |||
121 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 121 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
122 | for (c = 0; c < count; c++) | 122 | for (c = 0; c < count; c++) |
123 | { | 123 | { |
124 | rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value; | 124 | rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value_us; |
125 | rd[c].record_type = TEST_RECORD_TYPE; | 125 | rd[c].record_type = TEST_RECORD_TYPE; |
126 | rd[c].data_size = TEST_RECORD_DATALEN; | 126 | rd[c].data_size = TEST_RECORD_DATALEN; |
127 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); | 127 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); |
@@ -157,7 +157,7 @@ run (void *cls, | |||
157 | /* create record */ | 157 | /* create record */ |
158 | s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet"); | 158 | s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet"); |
159 | s_rd = create_record (RECORDS); | 159 | s_rd = create_record (RECORDS); |
160 | et.abs_value = s_rd[0].expiration_time; | 160 | et.abs_value_us = s_rd[0].expiration_time; |
161 | signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_rd, RECORDS); | 161 | signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_rd, RECORDS); |
162 | GNUNET_break (s_rd != NULL); | 162 | GNUNET_break (s_rd != NULL); |
163 | GNUNET_break (s_name != NULL); | 163 | GNUNET_break (s_name != NULL); |
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index f278b30db..19721f5a1 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c | |||
@@ -203,14 +203,14 @@ create_record (unsigned int count) | |||
203 | struct GNUNET_NAMESTORE_RecordData * rd; | 203 | struct GNUNET_NAMESTORE_RecordData * rd; |
204 | 204 | ||
205 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 205 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
206 | rd[0].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; | 206 | rd[0].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
207 | rd[0].record_type = 0; | 207 | rd[0].record_type = 0; |
208 | rd[0].data_size = TEST_REMOVE_RECORD_DATALEN; | 208 | rd[0].data_size = TEST_REMOVE_RECORD_DATALEN; |
209 | rd[0].data = GNUNET_malloc(TEST_REMOVE_RECORD_DATALEN); | 209 | rd[0].data = GNUNET_malloc(TEST_REMOVE_RECORD_DATALEN); |
210 | memset ((char *) rd[0].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); | 210 | memset ((char *) rd[0].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); |
211 | for (c = 1; c < count; c++) | 211 | for (c = 1; c < count; c++) |
212 | { | 212 | { |
213 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; | 213 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
214 | rd[c].record_type = TEST_RECORD_TYPE; | 214 | rd[c].record_type = TEST_RECORD_TYPE; |
215 | rd[c].data_size = TEST_RECORD_DATALEN; | 215 | rd[c].data_size = TEST_RECORD_DATALEN; |
216 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); | 216 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); |
@@ -250,7 +250,7 @@ run (void *cls, | |||
250 | GNUNET_NAMESTORE_records_serialize(RECORDS, s_rd, rd_ser_len, rd_ser); | 250 | GNUNET_NAMESTORE_records_serialize(RECORDS, s_rd, rd_ser_len, rd_ser); |
251 | 251 | ||
252 | /* sign */ | 252 | /* sign */ |
253 | et.abs_value = s_rd[0].expiration_time; | 253 | et.abs_value_us = s_rd[0].expiration_time; |
254 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_rd, RECORDS); | 254 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_rd, RECORDS); |
255 | 255 | ||
256 | /* create random zone hash */ | 256 | /* create random zone hash */ |
diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c index a85bc8c05..6247ff346 100644 --- a/src/namestore/test_namestore_api_remove_not_existing_record.c +++ b/src/namestore/test_namestore_api_remove_not_existing_record.c | |||
@@ -158,7 +158,7 @@ create_record (unsigned int count) | |||
158 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 158 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
159 | for (c = 0; c < count; c++) | 159 | for (c = 0; c < count; c++) |
160 | { | 160 | { |
161 | rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value; | 161 | rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value_us; |
162 | rd[c].record_type = TEST_RECORD_TYPE; | 162 | rd[c].record_type = TEST_RECORD_TYPE; |
163 | rd[c].data_size = TEST_RECORD_DATALEN; | 163 | rd[c].data_size = TEST_RECORD_DATALEN; |
164 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); | 164 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); |
@@ -198,7 +198,7 @@ run (void *cls, | |||
198 | GNUNET_NAMESTORE_records_serialize(RECORDS, s_rd, rd_ser_len, rd_ser); | 198 | GNUNET_NAMESTORE_records_serialize(RECORDS, s_rd, rd_ser_len, rd_ser); |
199 | 199 | ||
200 | /* sign */ | 200 | /* sign */ |
201 | et.abs_value = s_rd[0].expiration_time; | 201 | et.abs_value_us = s_rd[0].expiration_time; |
202 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_rd, RECORDS); | 202 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_rd, RECORDS); |
203 | 203 | ||
204 | /* create random zone hash */ | 204 | /* create random zone hash */ |
diff --git a/src/namestore/test_namestore_api_sign_verify.c b/src/namestore/test_namestore_api_sign_verify.c index e2913991c..41b9407e4 100644 --- a/src/namestore/test_namestore_api_sign_verify.c +++ b/src/namestore/test_namestore_api_sign_verify.c | |||
@@ -62,7 +62,7 @@ create_record (int count) | |||
62 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 62 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
63 | for (c = 0; c < count; c++) | 63 | for (c = 0; c < count; c++) |
64 | { | 64 | { |
65 | rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value; | 65 | rd[c].expiration_time = GNUNET_TIME_absolute_get().abs_value_us; |
66 | rd[c].record_type = TEST_RECORD_TYPE; | 66 | rd[c].record_type = TEST_RECORD_TYPE; |
67 | rd[c].data_size = TEST_RECORD_DATALEN; | 67 | rd[c].data_size = TEST_RECORD_DATALEN; |
68 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); | 68 | rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); |
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c index 63e4adf40..036944e9a 100644 --- a/src/namestore/test_namestore_api_zone_iteration.c +++ b/src/namestore/test_namestore_api_zone_iteration.c | |||
@@ -195,7 +195,9 @@ zone_proc (void *cls, | |||
195 | else | 195 | else |
196 | res = 1; | 196 | res = 1; |
197 | 197 | ||
198 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received last result, iteration done after receing %u results\n",returned_records ); | 198 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
199 | "Received last result, iteration done after receing %u results\n", | ||
200 | returned_records ); | ||
199 | GNUNET_SCHEDULER_add_now (&end, NULL); | 201 | GNUNET_SCHEDULER_add_now (&end, NULL); |
200 | } | 202 | } |
201 | else | 203 | else |
@@ -205,7 +207,10 @@ zone_proc (void *cls, | |||
205 | { | 207 | { |
206 | struct GNUNET_HashCode zone_key_hash; | 208 | struct GNUNET_HashCode zone_key_hash; |
207 | GNUNET_CRYPTO_hash (zone_key, sizeof (struct GNUNET_CRYPTO_EccPublicKey), &zone_key_hash); | 209 | GNUNET_CRYPTO_hash (zone_key, sizeof (struct GNUNET_CRYPTO_EccPublicKey), &zone_key_hash); |
208 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Verifying signature for `%s' in zone `%s' with %u records and expiration %llu failed\n", name, GNUNET_h2s(&zone_key_hash), rd_count, expire.abs_value); | 210 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
211 | "Verifying signature for `%s' in zone `%s' with %u records and expiration %s failed\n", | ||
212 | name, GNUNET_h2s(&zone_key_hash), rd_count, | ||
213 | GNUNET_STRINGS_absolute_time_to_string (expire)); | ||
209 | 214 | ||
210 | failed = GNUNET_YES; | 215 | failed = GNUNET_YES; |
211 | GNUNET_break (0); | 216 | GNUNET_break (0); |
@@ -337,7 +342,7 @@ create_record (unsigned int count) | |||
337 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 342 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
338 | for (c = 0; c < count; c++) | 343 | for (c = 0; c < count; c++) |
339 | { | 344 | { |
340 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; | 345 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
341 | rd[c].record_type = 1111; | 346 | rd[c].record_type = 1111; |
342 | rd[c].data_size = 50; | 347 | rd[c].data_size = 50; |
343 | rd[c].data = GNUNET_malloc(50); | 348 | rd[c].data = GNUNET_malloc(50); |
@@ -392,7 +397,7 @@ empty_zone_proc (void *cls, | |||
392 | 397 | ||
393 | GNUNET_asprintf(&s_name_1, "dummy1"); | 398 | GNUNET_asprintf(&s_name_1, "dummy1"); |
394 | s_rd_1 = create_record(1); | 399 | s_rd_1 = create_record(1); |
395 | et.abs_value = s_rd_1->expiration_time; | 400 | et.abs_value_us = s_rd_1->expiration_time; |
396 | sig_1 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_1, s_rd_1, 1); | 401 | sig_1 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_1, s_rd_1, 1); |
397 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_1, | 402 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_1, |
398 | 1, s_rd_1, | 403 | 1, s_rd_1, |
@@ -403,7 +408,7 @@ empty_zone_proc (void *cls, | |||
403 | GNUNET_asprintf(&s_name_2, "dummy2"); | 408 | GNUNET_asprintf(&s_name_2, "dummy2"); |
404 | s_rd_2 = create_record(1); | 409 | s_rd_2 = create_record(1); |
405 | 410 | ||
406 | et.abs_value = s_rd_2->expiration_time; | 411 | et.abs_value_us = s_rd_2->expiration_time; |
407 | sig_2 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_2, s_rd_2, 1); | 412 | sig_2 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_2, s_rd_2, 1); |
408 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_2, | 413 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_2, |
409 | 1, s_rd_2, | 414 | 1, s_rd_2, |
@@ -413,7 +418,7 @@ empty_zone_proc (void *cls, | |||
413 | /* name in different zone */ | 418 | /* name in different zone */ |
414 | GNUNET_asprintf(&s_name_3, "dummy3"); | 419 | GNUNET_asprintf(&s_name_3, "dummy3"); |
415 | s_rd_3 = create_record(1); | 420 | s_rd_3 = create_record(1); |
416 | et.abs_value = s_rd_3->expiration_time; | 421 | et.abs_value_us = s_rd_3->expiration_time; |
417 | sig_3 = GNUNET_NAMESTORE_create_signature(privkey2, et, s_name_3, s_rd_3, 1); | 422 | sig_3 = GNUNET_NAMESTORE_create_signature(privkey2, et, s_name_3, s_rd_3, 1); |
418 | GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, GNUNET_TIME_UNIT_FOREVER_ABS, 1, s_rd_3, sig_3, &put_cont, NULL); | 423 | GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, GNUNET_TIME_UNIT_FOREVER_ABS, 1, s_rd_3, sig_3, &put_cont, NULL); |
419 | } | 424 | } |
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c index 020c8358f..d0db013b7 100644 --- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c +++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c | |||
@@ -302,7 +302,7 @@ create_record (unsigned int count) | |||
302 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 302 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
303 | for (c = 0; c < count; c++) | 303 | for (c = 0; c < count; c++) |
304 | { | 304 | { |
305 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; | 305 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
306 | rd[c].record_type = 1111; | 306 | rd[c].record_type = 1111; |
307 | rd[c].data_size = 50; | 307 | rd[c].data_size = 50; |
308 | rd[c].data = GNUNET_malloc(50); | 308 | rd[c].data = GNUNET_malloc(50); |
@@ -344,7 +344,7 @@ run (void *cls, | |||
344 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n"); | 344 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n"); |
345 | GNUNET_asprintf(&s_name_1, "dummy1"); | 345 | GNUNET_asprintf(&s_name_1, "dummy1"); |
346 | s_rd_1 = create_record(1); | 346 | s_rd_1 = create_record(1); |
347 | et.abs_value = s_rd_1[0].expiration_time; | 347 | et.abs_value_us = s_rd_1[0].expiration_time; |
348 | sig_1 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_1, s_rd_1, 1); | 348 | sig_1 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_1, s_rd_1, 1); |
349 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_1, | 349 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_1, |
350 | 1, s_rd_1, | 350 | 1, s_rd_1, |
@@ -353,7 +353,7 @@ run (void *cls, | |||
353 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 2 \n"); | 353 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 2 \n"); |
354 | GNUNET_asprintf(&s_name_2, "dummy2"); | 354 | GNUNET_asprintf(&s_name_2, "dummy2"); |
355 | s_rd_2 = create_record(1); | 355 | s_rd_2 = create_record(1); |
356 | et.abs_value = s_rd_2[0].expiration_time; | 356 | et.abs_value_us = s_rd_2[0].expiration_time; |
357 | sig_2 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_2, s_rd_2, 1); | 357 | sig_2 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_2, s_rd_2, 1); |
358 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_2, | 358 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_2, |
359 | 1, s_rd_2, | 359 | 1, s_rd_2, |
@@ -363,7 +363,7 @@ run (void *cls, | |||
363 | /* name in different zone */ | 363 | /* name in different zone */ |
364 | GNUNET_asprintf(&s_name_3, "dummy3"); | 364 | GNUNET_asprintf(&s_name_3, "dummy3"); |
365 | s_rd_3 = create_record(1); | 365 | s_rd_3 = create_record(1); |
366 | et.abs_value = s_rd_3[0].expiration_time; | 366 | et.abs_value_us = s_rd_3[0].expiration_time; |
367 | sig_3 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_3, s_rd_3, 1); | 367 | sig_3 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_3, s_rd_3, 1); |
368 | GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, | 368 | GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, |
369 | GNUNET_TIME_UNIT_FOREVER_ABS, 1, s_rd_3, sig_3, &put_cont, NULL); | 369 | GNUNET_TIME_UNIT_FOREVER_ABS, 1, s_rd_3, sig_3, &put_cont, NULL); |
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c index 5d44555d1..abd7c2564 100644 --- a/src/namestore/test_namestore_api_zone_iteration_stop.c +++ b/src/namestore/test_namestore_api_zone_iteration_stop.c | |||
@@ -361,7 +361,7 @@ create_record (unsigned int count) | |||
361 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 361 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
362 | for (c = 0; c < count; c++) | 362 | for (c = 0; c < count; c++) |
363 | { | 363 | { |
364 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value; | 364 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
365 | rd[c].record_type = 1111; | 365 | rd[c].record_type = 1111; |
366 | rd[c].data_size = 50; | 366 | rd[c].data_size = 50; |
367 | rd[c].data = GNUNET_malloc(50); | 367 | rd[c].data = GNUNET_malloc(50); |
@@ -405,7 +405,7 @@ run (void *cls, | |||
405 | 405 | ||
406 | GNUNET_asprintf(&s_name_1, "dummy1"); | 406 | GNUNET_asprintf(&s_name_1, "dummy1"); |
407 | s_rd_1 = create_record(1); | 407 | s_rd_1 = create_record(1); |
408 | et.abs_value = s_rd_1[0].expiration_time; | 408 | et.abs_value_us = s_rd_1[0].expiration_time; |
409 | sig_1 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_1, s_rd_1, 1); | 409 | sig_1 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_1, s_rd_1, 1); |
410 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_1, | 410 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_1, |
411 | 1, s_rd_1, &put_cont, NULL); | 411 | 1, s_rd_1, &put_cont, NULL); |
@@ -415,7 +415,7 @@ run (void *cls, | |||
415 | GNUNET_asprintf(&s_name_2, "dummy2"); | 415 | GNUNET_asprintf(&s_name_2, "dummy2"); |
416 | s_rd_2 = create_record(1); | 416 | s_rd_2 = create_record(1); |
417 | 417 | ||
418 | et.abs_value = s_rd_2[0].expiration_time; | 418 | et.abs_value_us = s_rd_2[0].expiration_time; |
419 | sig_2 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_2, s_rd_2, 1); | 419 | sig_2 = GNUNET_NAMESTORE_create_signature(privkey, et, s_name_2, s_rd_2, 1); |
420 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_2, | 420 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, s_name_2, |
421 | 1, s_rd_2, &put_cont, NULL); | 421 | 1, s_rd_2, &put_cont, NULL); |
@@ -424,7 +424,7 @@ run (void *cls, | |||
424 | /* name in different zone */ | 424 | /* name in different zone */ |
425 | GNUNET_asprintf(&s_name_3, "dummy3"); | 425 | GNUNET_asprintf(&s_name_3, "dummy3"); |
426 | s_rd_3 = create_record(1); | 426 | s_rd_3 = create_record(1); |
427 | et.abs_value = s_rd_3[0].expiration_time; | 427 | et.abs_value_us = s_rd_3[0].expiration_time; |
428 | sig_3 = GNUNET_NAMESTORE_create_signature(privkey2, et, s_name_3, s_rd_3, 1); | 428 | sig_3 = GNUNET_NAMESTORE_create_signature(privkey2, et, s_name_3, s_rd_3, 1); |
429 | GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, GNUNET_TIME_UNIT_FOREVER_ABS, 1, s_rd_3, sig_3, &put_cont, NULL); | 429 | GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, GNUNET_TIME_UNIT_FOREVER_ABS, 1, s_rd_3, sig_3, &put_cont, NULL); |
430 | } | 430 | } |
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c index e1fefec09..ea242c49e 100644 --- a/src/namestore/test_namestore_api_zone_to_name.c +++ b/src/namestore/test_namestore_api_zone_to_name.c | |||
@@ -187,7 +187,7 @@ run (void *cls, | |||
187 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using PKEY `%s' \n", GNUNET_NAMESTORE_short_h2s (&s_zone_value)); | 187 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using PKEY `%s' \n", GNUNET_NAMESTORE_short_h2s (&s_zone_value)); |
188 | 188 | ||
189 | struct GNUNET_NAMESTORE_RecordData rd; | 189 | struct GNUNET_NAMESTORE_RecordData rd; |
190 | rd.expiration_time = GNUNET_TIME_absolute_get().abs_value; | 190 | rd.expiration_time = GNUNET_TIME_absolute_get().abs_value_us; |
191 | rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; | 191 | rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; |
192 | rd.data_size = sizeof (struct GNUNET_CRYPTO_ShortHashCode); | 192 | rd.data_size = sizeof (struct GNUNET_CRYPTO_ShortHashCode); |
193 | rd.data = GNUNET_malloc(sizeof (struct GNUNET_CRYPTO_ShortHashCode)); | 193 | rd.data = GNUNET_malloc(sizeof (struct GNUNET_CRYPTO_ShortHashCode)); |
@@ -196,7 +196,7 @@ run (void *cls, | |||
196 | GNUNET_break (NULL != nsh); | 196 | GNUNET_break (NULL != nsh); |
197 | 197 | ||
198 | expire = GNUNET_TIME_absolute_get (); | 198 | expire = GNUNET_TIME_absolute_get (); |
199 | et.abs_value = rd.expiration_time; | 199 | et.abs_value_us = rd.expiration_time; |
200 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, &rd, 1); | 200 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, &rd, 1); |
201 | GNUNET_NAMESTORE_record_put(nsh, &pubkey, s_name, expire, 1, &rd, s_signature, put_cont, NULL); | 201 | GNUNET_NAMESTORE_record_put(nsh, &pubkey, s_name, expire, 1, &rd, s_signature, put_cont, NULL); |
202 | 202 | ||
diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c index 35c9e920f..4b5a75b5e 100644 --- a/src/namestore/test_plugin_namestore.c +++ b/src/namestore/test_plugin_namestore.c | |||
@@ -154,7 +154,7 @@ put_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, int id) | |||
154 | { | 154 | { |
155 | rd[i].data = "Hello World"; | 155 | rd[i].data = "Hello World"; |
156 | rd[i].data_size = id % 10; | 156 | rd[i].data_size = id % 10; |
157 | rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value; | 157 | rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value_us; |
158 | rd[i].record_type = 1 + (id % 13); | 158 | rd[i].record_type = 1 + (id % 13); |
159 | rd[i].flags = (id % 7); | 159 | rd[i].flags = (id % 7); |
160 | } | 160 | } |
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c index d55e61e60..b6f1c463a 100644 --- a/src/nse/gnunet-nse-profiler.c +++ b/src/nse/gnunet-nse-profiler.c | |||
@@ -366,7 +366,7 @@ handle_estimate (void *cls, | |||
366 | sizeof (output_buffer), | 366 | sizeof (output_buffer), |
367 | "%p %llu %llu %f %f %f\n", | 367 | "%p %llu %llu %f %f %f\n", |
368 | peer, peers_running, | 368 | peer, peers_running, |
369 | timestamp.abs_value, | 369 | (unsigned long long) timestamp.abs_value_us, |
370 | GNUNET_NSE_log_estimate_to_n (estimate), estimate, | 370 | GNUNET_NSE_log_estimate_to_n (estimate), estimate, |
371 | std_dev); | 371 | std_dev); |
372 | if (size != GNUNET_DISK_file_write (output_file, output_buffer, size)) | 372 | if (size != GNUNET_DISK_file_write (output_file, output_buffer, size)) |
@@ -435,7 +435,8 @@ stat_iterator (void *cls, const char *subsystem, const char *name, | |||
435 | if (0 != flag) | 435 | if (0 != flag) |
436 | flag = 1; | 436 | flag = 1; |
437 | size = GNUNET_asprintf (&output_buffer, "%llu %llu %u\n", | 437 | size = GNUNET_asprintf (&output_buffer, "%llu %llu %u\n", |
438 | now.abs_value/1000, value, flag); | 438 | now.abs_value_us / 1000LL / 1000LL, |
439 | value, flag); | ||
439 | if (size != GNUNET_DISK_file_write (data_file, output_buffer, size)) | 440 | if (size != GNUNET_DISK_file_write (data_file, output_buffer, size)) |
440 | { | 441 | { |
441 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); | 442 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); |
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 832c43abc..978712d53 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c | |||
@@ -440,8 +440,8 @@ get_matching_bits_delay (uint32_t matching_bits) | |||
440 | // f is frequency (gnunet_nse_interval) | 440 | // f is frequency (gnunet_nse_interval) |
441 | // x is matching_bits | 441 | // x is matching_bits |
442 | // p' is current_size_estimate | 442 | // p' is current_size_estimate |
443 | return ((double) gnunet_nse_interval.rel_value / (double) 2.0) - | 443 | return ((double) gnunet_nse_interval.rel_value_us / (double) 2.0) - |
444 | ((gnunet_nse_interval.rel_value / M_PI) * | 444 | ((gnunet_nse_interval.rel_value_us / M_PI) * |
445 | atan (matching_bits - current_size_estimate)); | 445 | atan (matching_bits - current_size_estimate)); |
446 | } | 446 | } |
447 | 447 | ||
@@ -462,10 +462,12 @@ get_delay_randomization (uint32_t matching_bits) | |||
462 | 462 | ||
463 | d = get_matching_bits_delay (matching_bits); | 463 | d = get_matching_bits_delay (matching_bits); |
464 | i = (uint32_t) (d / (double) (hop_count_max + 1)); | 464 | i = (uint32_t) (d / (double) (hop_count_max + 1)); |
465 | ret.rel_value_us = i; | ||
465 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 466 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
466 | "Randomizing flood using latencies up to %u ms\n", | 467 | "Randomizing flood using latencies up to %s\n", |
467 | (unsigned int) i); | 468 | GNUNET_STRINGS_relative_time_to_string (ret, |
468 | ret.rel_value = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, i + 1); | 469 | GNUNET_YES)); |
470 | ret.rel_value_us = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, i + 1); | ||
469 | return ret; | 471 | return ret; |
470 | #else | 472 | #else |
471 | return GNUNET_TIME_UNIT_ZERO; | 473 | return GNUNET_TIME_UNIT_ZERO; |
@@ -508,7 +510,7 @@ get_matching_bits (struct GNUNET_TIME_Absolute timestamp, | |||
508 | { | 510 | { |
509 | struct GNUNET_HashCode timestamp_hash; | 511 | struct GNUNET_HashCode timestamp_hash; |
510 | 512 | ||
511 | GNUNET_CRYPTO_hash (×tamp.abs_value, sizeof (timestamp.abs_value), | 513 | GNUNET_CRYPTO_hash (×tamp.abs_value_us, sizeof (timestamp.abs_value_us), |
512 | ×tamp_hash); | 514 | ×tamp_hash); |
513 | return GNUNET_CRYPTO_hash_matching_bits (×tamp_hash, &id->hashPubKey); | 515 | return GNUNET_CRYPTO_hash_matching_bits (×tamp_hash, &id->hashPubKey); |
514 | } | 516 | } |
@@ -535,26 +537,27 @@ get_transmit_delay (int round_offset) | |||
535 | case -1: | 537 | case -1: |
536 | /* previous round is randomized between 0 and 50 ms */ | 538 | /* previous round is randomized between 0 and 50 ms */ |
537 | #if USE_RANDOM_DELAYS | 539 | #if USE_RANDOM_DELAYS |
538 | ret.rel_value = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, 50); | 540 | ret.rel_value_us = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, 50); |
539 | #else | 541 | #else |
540 | ret = GNUNET_TIME_UNIT_ZERO; | 542 | ret = GNUNET_TIME_UNIT_ZERO; |
541 | #endif | 543 | #endif |
542 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 544 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
543 | "Transmitting previous round behind schedule in %llu ms\n", | 545 | "Transmitting previous round behind schedule in %s\n", |
544 | (unsigned long long) ret.rel_value); | 546 | GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES)); |
545 | return ret; | 547 | return ret; |
546 | case 0: | 548 | case 0: |
547 | /* current round is based on best-known matching_bits */ | 549 | /* current round is based on best-known matching_bits */ |
548 | matching_bits = | 550 | matching_bits = |
549 | ntohl (size_estimate_messages[estimate_index].matching_bits); | 551 | ntohl (size_estimate_messages[estimate_index].matching_bits); |
550 | dist_delay = get_matching_bits_delay (matching_bits); | 552 | dist_delay = get_matching_bits_delay (matching_bits); |
551 | dist_delay += get_delay_randomization (matching_bits).rel_value; | 553 | dist_delay += get_delay_randomization (matching_bits).rel_value_us; |
552 | ret.rel_value = (uint64_t) dist_delay; | 554 | ret.rel_value_us = (uint64_t) dist_delay; |
553 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 555 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
554 | "For round %llu, delay for %u matching bits is %llu ms\n", | 556 | "For round %s, delay for %u matching bits is %s\n", |
555 | (unsigned long long) current_timestamp.abs_value, | 557 | GNUNET_STRINGS_absolute_time_to_string (current_timestamp), |
556 | (unsigned int) matching_bits, | 558 | (unsigned int) matching_bits, |
557 | (unsigned long long) ret.rel_value); | 559 | GNUNET_STRINGS_relative_time_to_string (ret, |
560 | GNUNET_YES)); | ||
558 | /* now consider round start time and add delay to it */ | 561 | /* now consider round start time and add delay to it */ |
559 | tgt = GNUNET_TIME_absolute_add (current_timestamp, ret); | 562 | tgt = GNUNET_TIME_absolute_add (current_timestamp, ret); |
560 | return GNUNET_TIME_absolute_get_remaining (tgt); | 563 | return GNUNET_TIME_absolute_get_remaining (tgt); |
@@ -621,10 +624,8 @@ transmit_ready (void *cls, size_t size, void *buf) | |||
621 | return 0; | 624 | return 0; |
622 | } | 625 | } |
623 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 626 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
624 | "In round %llu, sending to `%s' estimate with %u bits\n", | 627 | "In round s, sending to `%s' estimate with %u bits\n", |
625 | (unsigned long long) | 628 | GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (size_estimate_messages[idx].timestamp)), |
626 | GNUNET_TIME_absolute_ntoh (size_estimate_messages[idx]. | ||
627 | timestamp).abs_value, | ||
628 | GNUNET_i2s (&peer_entry->id), | 629 | GNUNET_i2s (&peer_entry->id), |
629 | (unsigned int) ntohl (size_estimate_messages[idx].matching_bits)); | 630 | (unsigned int) ntohl (size_estimate_messages[idx].matching_bits)); |
630 | if (ntohl (size_estimate_messages[idx].hop_count) == 0) | 631 | if (ntohl (size_estimate_messages[idx].hop_count) == 0) |
@@ -778,7 +779,7 @@ update_flood_message (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
778 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 779 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
779 | return; | 780 | return; |
780 | offset = GNUNET_TIME_absolute_get_remaining (next_timestamp); | 781 | offset = GNUNET_TIME_absolute_get_remaining (next_timestamp); |
781 | if (0 != offset.rel_value) | 782 | if (0 != offset.rel_value_us) |
782 | { | 783 | { |
783 | /* somehow run early, delay more */ | 784 | /* somehow run early, delay more */ |
784 | flood_task = | 785 | flood_task = |
@@ -791,8 +792,8 @@ update_flood_message (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
791 | current_timestamp = next_timestamp; | 792 | current_timestamp = next_timestamp; |
792 | next_timestamp = | 793 | next_timestamp = |
793 | GNUNET_TIME_absolute_add (current_timestamp, gnunet_nse_interval); | 794 | GNUNET_TIME_absolute_add (current_timestamp, gnunet_nse_interval); |
794 | if ((current_timestamp.abs_value == | 795 | if ((current_timestamp.abs_value_us == |
795 | GNUNET_TIME_absolute_ntoh (next_message.timestamp).abs_value) && | 796 | GNUNET_TIME_absolute_ntoh (next_message.timestamp).abs_value_us) && |
796 | (get_matching_bits (current_timestamp, &my_identity) < | 797 | (get_matching_bits (current_timestamp, &my_identity) < |
797 | ntohl(next_message.matching_bits))) | 798 | ntohl(next_message.matching_bits))) |
798 | { | 799 | { |
@@ -1038,7 +1039,7 @@ handle_p2p_size_estimate (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1038 | { | 1039 | { |
1039 | uint64_t t; | 1040 | uint64_t t; |
1040 | 1041 | ||
1041 | t = GNUNET_TIME_absolute_get().abs_value; | 1042 | t = GNUNET_TIME_absolute_get().abs_value_us; |
1042 | GNUNET_TESTBED_LOGGER_write (lh, &t, sizeof (uint64_t)); | 1043 | GNUNET_TESTBED_LOGGER_write (lh, &t, sizeof (uint64_t)); |
1043 | } | 1044 | } |
1044 | #endif | 1045 | #endif |
@@ -1078,12 +1079,12 @@ handle_p2p_size_estimate (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1078 | #endif | 1079 | #endif |
1079 | 1080 | ||
1080 | ts = GNUNET_TIME_absolute_ntoh (incoming_flood->timestamp); | 1081 | ts = GNUNET_TIME_absolute_ntoh (incoming_flood->timestamp); |
1081 | if (ts.abs_value == current_timestamp.abs_value) | 1082 | if (ts.abs_value_us == current_timestamp.abs_value_us) |
1082 | idx = estimate_index; | 1083 | idx = estimate_index; |
1083 | else if (ts.abs_value == | 1084 | else if (ts.abs_value_us == |
1084 | current_timestamp.abs_value - gnunet_nse_interval.rel_value) | 1085 | current_timestamp.abs_value_us - gnunet_nse_interval.rel_value_us) |
1085 | idx = (estimate_index + HISTORY_SIZE - 1) % HISTORY_SIZE; | 1086 | idx = (estimate_index + HISTORY_SIZE - 1) % HISTORY_SIZE; |
1086 | else if (ts.abs_value == next_timestamp.abs_value) | 1087 | else if (ts.abs_value_us == next_timestamp.abs_value_us) |
1087 | { | 1088 | { |
1088 | if (matching_bits <= ntohl (next_message.matching_bits)) | 1089 | if (matching_bits <= ntohl (next_message.matching_bits)) |
1089 | return GNUNET_OK; /* ignore, simply too early/late */ | 1090 | return GNUNET_OK; /* ignore, simply too early/late */ |
@@ -1359,9 +1360,9 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server, | |||
1359 | memcmp (&my_identity, identity, | 1360 | memcmp (&my_identity, identity, |
1360 | sizeof (struct GNUNET_PeerIdentity))); | 1361 | sizeof (struct GNUNET_PeerIdentity))); |
1361 | now = GNUNET_TIME_absolute_get (); | 1362 | now = GNUNET_TIME_absolute_get (); |
1362 | current_timestamp.abs_value = | 1363 | current_timestamp.abs_value_us = |
1363 | (now.abs_value / gnunet_nse_interval.rel_value) * | 1364 | (now.abs_value_us / gnunet_nse_interval.rel_value_us) * |
1364 | gnunet_nse_interval.rel_value; | 1365 | gnunet_nse_interval.rel_value_us; |
1365 | next_timestamp = | 1366 | next_timestamp = |
1366 | GNUNET_TIME_absolute_add (current_timestamp, gnunet_nse_interval); | 1367 | GNUNET_TIME_absolute_add (current_timestamp, gnunet_nse_interval); |
1367 | estimate_index = HISTORY_SIZE - 1; | 1368 | estimate_index = HISTORY_SIZE - 1; |
@@ -1369,8 +1370,8 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server, | |||
1369 | if (GNUNET_YES == check_proof_of_work (&my_public_key, my_proof)) | 1370 | if (GNUNET_YES == check_proof_of_work (&my_public_key, my_proof)) |
1370 | { | 1371 | { |
1371 | int idx = (estimate_index + HISTORY_SIZE - 1) % HISTORY_SIZE; | 1372 | int idx = (estimate_index + HISTORY_SIZE - 1) % HISTORY_SIZE; |
1372 | prev_time.abs_value = | 1373 | prev_time.abs_value_us = |
1373 | current_timestamp.abs_value - gnunet_nse_interval.rel_value; | 1374 | current_timestamp.abs_value_us - gnunet_nse_interval.rel_value_us; |
1374 | setup_flood_message (idx, prev_time); | 1375 | setup_flood_message (idx, prev_time); |
1375 | setup_flood_message (estimate_index, current_timestamp); | 1376 | setup_flood_message (estimate_index, current_timestamp); |
1376 | estimate_count++; | 1377 | estimate_count++; |
diff --git a/src/nse/nse_api.c b/src/nse/nse_api.c index 8f4486287..211071c0d 100644 --- a/src/nse/nse_api.c +++ b/src/nse/nse_api.c | |||
@@ -24,14 +24,11 @@ | |||
24 | * @author Nathan Evans | 24 | * @author Nathan Evans |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_client_lib.h" | ||
28 | #include "gnunet_constants.h" | 27 | #include "gnunet_constants.h" |
29 | #include "gnunet_container_lib.h" | ||
30 | #include "gnunet_arm_service.h" | 28 | #include "gnunet_arm_service.h" |
31 | #include "gnunet_hello_lib.h" | 29 | #include "gnunet_hello_lib.h" |
32 | #include "gnunet_protocols.h" | 30 | #include "gnunet_protocols.h" |
33 | #include "gnunet_server_lib.h" | 31 | #include "gnunet_util_lib.h" |
34 | #include "gnunet_time_lib.h" | ||
35 | #include "gnunet_nse_service.h" | 32 | #include "gnunet_nse_service.h" |
36 | #include "nse.h" | 33 | #include "nse.h" |
37 | 34 | ||
@@ -150,8 +147,9 @@ reschedule_connect (struct GNUNET_NSE_Handle *h) | |||
150 | } | 147 | } |
151 | 148 | ||
152 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 149 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
153 | "Scheduling task to reconnect to nse service in %llu ms.\n", | 150 | "Scheduling task to reconnect to nse service in %s.\n", |
154 | h->reconnect_delay.rel_value); | 151 | GNUNET_STRINGS_relative_time_to_string (h->reconnect_delay, |
152 | GNUNET_YES)); | ||
155 | h->reconnect_task = | 153 | h->reconnect_task = |
156 | GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h); | 154 | GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h); |
157 | h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay); | 155 | h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay); |
diff --git a/src/nse/perf_kdf.c b/src/nse/perf_kdf.c index fbc846ac2..89ddada81 100644 --- a/src/nse/perf_kdf.c +++ b/src/nse/perf_kdf.c | |||
@@ -79,7 +79,7 @@ main (int argc, char *argv[]) | |||
79 | GAUGER ("NSE", "Proof-of-work hashing", | 79 | GAUGER ("NSE", "Proof-of-work hashing", |
80 | 1024 / (1 + | 80 | 1024 / (1 + |
81 | GNUNET_TIME_absolute_get_duration | 81 | GNUNET_TIME_absolute_get_duration |
82 | (start).rel_value), "hashes/s"); | 82 | (start).rel_value_us / 1000LL), "hashes/ms"); |
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | 85 | ||
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index 6be98879f..fc953ad3e 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c | |||
@@ -209,7 +209,7 @@ discard_expired (void *cls, const struct GNUNET_HELLO_Address *address, | |||
209 | { | 209 | { |
210 | const struct GNUNET_TIME_Absolute *now = cls; | 210 | const struct GNUNET_TIME_Absolute *now = cls; |
211 | 211 | ||
212 | if (now->abs_value > expiration.abs_value) | 212 | if (now->abs_value_us > expiration.abs_value_us) |
213 | { | 213 | { |
214 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 214 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
215 | _("Removing expired address of transport `%s'\n"), | 215 | _("Removing expired address of transport `%s'\n"), |
@@ -728,7 +728,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer, | |||
728 | { | 728 | { |
729 | mrg = GNUNET_HELLO_merge ((*dest), hello); | 729 | mrg = GNUNET_HELLO_merge ((*dest), hello); |
730 | delta = GNUNET_HELLO_equals (mrg, (*dest), GNUNET_TIME_absolute_get ()); | 730 | delta = GNUNET_HELLO_equals (mrg, (*dest), GNUNET_TIME_absolute_get ()); |
731 | if (delta.abs_value == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value) | 731 | if (delta.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) |
732 | { | 732 | { |
733 | /* no differences, just ignore the update */ | 733 | /* no differences, just ignore the update */ |
734 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No change in %s HELLO for `%s'\n", | 734 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No change in %s HELLO for `%s'\n", |
diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c index d30c64c2f..2ba72bba9 100644 --- a/src/pt/test_gns_vpn.c +++ b/src/pt/test_gns_vpn.c | |||
@@ -393,7 +393,7 @@ run (void *cls, | |||
393 | } | 393 | } |
394 | 394 | ||
395 | host_key = GNUNET_CRYPTO_ecc_key_create_from_file (zone_keyfile); | 395 | host_key = GNUNET_CRYPTO_ecc_key_create_from_file (zone_keyfile); |
396 | rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value; | 396 | rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; |
397 | GNUNET_asprintf (&rd_string, "6 %s %s", (char*)&peername, "www.gads."); | 397 | GNUNET_asprintf (&rd_string, "6 %s %s", (char*)&peername, "www.gads."); |
398 | GNUNET_assert (GNUNET_OK == GNUNET_NAMESTORE_string_to_value (GNUNET_GNS_RECORD_VPN, | 398 | GNUNET_assert (GNUNET_OK == GNUNET_NAMESTORE_string_to_value (GNUNET_GNS_RECORD_VPN, |
399 | rd_string, | 399 | rd_string, |
diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c index d4c9cb7cb..86f7d451b 100644 --- a/src/regex/gnunet-daemon-regexprofiler.c +++ b/src/regex/gnunet-daemon-regexprofiler.c | |||
@@ -179,10 +179,10 @@ reannounce_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | random_delay = | 181 | random_delay = |
182 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, | 182 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS, |
183 | GNUNET_CRYPTO_random_u32 ( | 183 | GNUNET_CRYPTO_random_u32 ( |
184 | GNUNET_CRYPTO_QUALITY_WEAK, | 184 | GNUNET_CRYPTO_QUALITY_WEAK, |
185 | reannounce_period_max.rel_value)); | 185 | reannounce_period_max.rel_value_us)); |
186 | reannounce_task = GNUNET_SCHEDULER_add_delayed (random_delay, | 186 | reannounce_task = GNUNET_SCHEDULER_add_delayed (random_delay, |
187 | &reannounce_regex, cls); | 187 | &reannounce_regex, cls); |
188 | } | 188 | } |
diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c index 317f65d8d..681ade880 100644 --- a/src/regex/plugin_block_regex.c +++ b/src/regex/plugin_block_regex.c | |||
@@ -177,7 +177,7 @@ evaluate_block_regex_accept (void *cls, enum GNUNET_BLOCK_Type type, | |||
177 | GNUNET_break_op(0); | 177 | GNUNET_break_op(0); |
178 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 178 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
179 | } | 179 | } |
180 | if (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (rba->expiration_time)).rel_value) | 180 | if (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (rba->expiration_time)).rel_value_us) |
181 | { | 181 | { |
182 | /* technically invalid, but can happen without an error, so | 182 | /* technically invalid, but can happen without an error, so |
183 | we're nice by reporting it as a 'duplicate' */ | 183 | we're nice by reporting it as a 'duplicate' */ |
diff --git a/src/sysmon/gnunet-service-sysmon.c b/src/sysmon/gnunet-service-sysmon.c index b5fc46ac8..0aa96b7f7 100644 --- a/src/sysmon/gnunet-service-sysmon.c +++ b/src/sysmon/gnunet-service-sysmon.c | |||
@@ -277,7 +277,7 @@ update_uptime (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
277 | if (GNUNET_YES == first_run) | 277 | if (GNUNET_YES == first_run) |
278 | first_run = GNUNET_NO; | 278 | first_run = GNUNET_NO; |
279 | else | 279 | else |
280 | sp->num_val += sp->interval.rel_value / 1000; | 280 | sp->num_val += sp->interval.rel_value_us / 1000LL / 1000LL; |
281 | 281 | ||
282 | put_property (sp); | 282 | put_property (sp); |
283 | } | 283 | } |
@@ -548,11 +548,13 @@ load_property (void *cls, | |||
548 | } | 548 | } |
549 | } | 549 | } |
550 | 550 | ||
551 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Loaded property `%s': %s, %s, interval %llu\n", | 551 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
552 | (NULL != sp->desc) ? sp->desc: "<undefined>", | 552 | "Loaded property `%s': %s, %s, interval %s\n", |
553 | (t_continous == sp->type) ? "continious" : "static", | 553 | (NULL != sp->desc) ? sp->desc: "<undefined>", |
554 | (v_numeric == sp->value_type) ? "numeric" : "string", | 554 | (t_continous == sp->type) ? "continious" : "static", |
555 | sp->interval.rel_value); | 555 | (v_numeric == sp->value_type) ? "numeric" : "string", |
556 | GNUNET_STRINGS_relative_time_to_string (sp->interval, | ||
557 | GNUNET_YES)); | ||
556 | 558 | ||
557 | GNUNET_CONTAINER_DLL_insert (sp_head, sp_tail, sp); | 559 | GNUNET_CONTAINER_DLL_insert (sp_head, sp_tail, sp); |
558 | 560 | ||
@@ -615,7 +617,7 @@ load_default_properties (void) | |||
615 | sp->desc = GNUNET_strdup ("GNUnet startup time"); | 617 | sp->desc = GNUNET_strdup ("GNUnet startup time"); |
616 | sp->type = t_static; | 618 | sp->type = t_static; |
617 | sp->value_type = v_numeric; | 619 | sp->value_type = v_numeric; |
618 | sp->num_val = (uint64_t) GNUNET_TIME_absolute_get().abs_value; | 620 | sp->num_val = (uint64_t) GNUNET_TIME_absolute_get().abs_value_us; |
619 | GNUNET_CONTAINER_DLL_insert (sp_head, sp_tail, sp); | 621 | GNUNET_CONTAINER_DLL_insert (sp_head, sp_tail, sp); |
620 | 622 | ||
621 | 623 | ||
diff --git a/src/testbed/gnunet-service-testbed_cpustatus.c b/src/testbed/gnunet-service-testbed_cpustatus.c index 8145410fb..4b61a039c 100644 --- a/src/testbed/gnunet-service-testbed_cpustatus.c +++ b/src/testbed/gnunet-service-testbed_cpustatus.c | |||
@@ -527,7 +527,7 @@ updateAgedLoad () | |||
527 | 527 | ||
528 | age = GNUNET_TIME_absolute_get_duration (lastCall); | 528 | age = GNUNET_TIME_absolute_get_duration (lastCall); |
529 | if ( (agedCPULoad == -1) | 529 | if ( (agedCPULoad == -1) |
530 | || (age.rel_value > 500) ) | 530 | || (age.rel_value_us > 500000) ) |
531 | { | 531 | { |
532 | /* use smoothing, but do NOT update lastRet at frequencies higher | 532 | /* use smoothing, but do NOT update lastRet at frequencies higher |
533 | than 500ms; this makes the smoothing (mostly) independent from | 533 | than 500ms; this makes the smoothing (mostly) independent from |
@@ -667,7 +667,7 @@ sample_load_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
667 | nproc = 0; | 667 | nproc = 0; |
668 | #endif | 668 | #endif |
669 | now = GNUNET_TIME_absolute_get (); | 669 | now = GNUNET_TIME_absolute_get (); |
670 | nbs = GNUNET_asprintf (&str, "%llu %d %d %u %u\n", now.abs_value / 1000, | 670 | nbs = GNUNET_asprintf (&str, "%llu %d %d %u %u\n", now.abs_value_us / 1000LL / 1000LL, |
671 | ld_cpu, ld_disk, mem_usage, nproc); | 671 | ld_cpu, ld_disk, mem_usage, nproc); |
672 | if (0 < nbs) | 672 | if (0 < nbs) |
673 | { | 673 | { |
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index bb6197e9a..cd805dca1 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c | |||
@@ -1695,12 +1695,12 @@ decide_npoc (struct GNUNET_TESTBED_Host *h) | |||
1695 | } | 1695 | } |
1696 | GNUNET_assert (nvals >= h->num_parallel_connects); | 1696 | GNUNET_assert (nvals >= h->num_parallel_connects); |
1697 | avg = GNUNET_TIME_relative_divide (avg, nvals); | 1697 | avg = GNUNET_TIME_relative_divide (avg, nvals); |
1698 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value != avg.rel_value); | 1698 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != avg.rel_value_us); |
1699 | sd = GNUNET_TESTBED_SD_deviation_factor_ (h->poc_sd, (unsigned int) avg.rel_value); | 1699 | sd = GNUNET_TESTBED_SD_deviation_factor_ (h->poc_sd, (unsigned int) avg.rel_value_us); |
1700 | if ( (sd <= 5) || | 1700 | if ( (sd <= 5) || |
1701 | (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 1701 | (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
1702 | h->num_parallel_connects)) ) | 1702 | h->num_parallel_connects)) ) |
1703 | GNUNET_TESTBED_SD_add_data_ (h->poc_sd, (unsigned int) avg.rel_value); | 1703 | GNUNET_TESTBED_SD_add_data_ (h->poc_sd, (unsigned int) avg.rel_value_us); |
1704 | if (GNUNET_SYSERR == sd) | 1704 | if (GNUNET_SYSERR == sd) |
1705 | { | 1705 | { |
1706 | GNUNET_TESTBED_set_num_parallel_overlay_connects_ (h, | 1706 | GNUNET_TESTBED_set_num_parallel_overlay_connects_ (h, |
@@ -1798,7 +1798,7 @@ GNUNET_TESTBED_update_time_slot_ (struct GNUNET_TESTBED_Host *h, | |||
1798 | return; | 1798 | return; |
1799 | slot = &h->tslots[index]; | 1799 | slot = &h->tslots[index]; |
1800 | slot->nvals++; | 1800 | slot->nvals++; |
1801 | if (GNUNET_TIME_UNIT_ZERO.rel_value == slot->time.rel_value) | 1801 | if (GNUNET_TIME_UNIT_ZERO.rel_value_us == slot->time.rel_value_us) |
1802 | { | 1802 | { |
1803 | slot->time = time; | 1803 | slot->time = time; |
1804 | h->tslots_filled++; | 1804 | h->tslots_filled++; |
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index 61ee308f8..6687ee02a 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2007, 2008, 2009, 2010 Christian Grothoff (and other contributing authors) | 3 | (C) 2007-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -362,7 +362,7 @@ attempt_connect (struct Peer *pos) | |||
362 | return; | 362 | return; |
363 | if (GNUNET_OK != is_connection_allowed (pos)) | 363 | if (GNUNET_OK != is_connection_allowed (pos)) |
364 | return; | 364 | return; |
365 | if (GNUNET_TIME_absolute_get_remaining (pos->greylisted_until).rel_value > 0) | 365 | if (GNUNET_TIME_absolute_get_remaining (pos->greylisted_until).rel_value_us > 0) |
366 | return; | 366 | return; |
367 | if (GNUNET_YES == pos->is_friend) | 367 | if (GNUNET_YES == pos->is_friend) |
368 | rem = GREYLIST_AFTER_ATTEMPT_FRIEND; | 368 | rem = GREYLIST_AFTER_ATTEMPT_FRIEND; |
@@ -407,7 +407,7 @@ do_attempt_connect (void *cls, | |||
407 | if (GNUNET_YES == pos->is_connected) | 407 | if (GNUNET_YES == pos->is_connected) |
408 | return; | 408 | return; |
409 | delay = GNUNET_TIME_absolute_get_remaining (next_connect_attempt); | 409 | delay = GNUNET_TIME_absolute_get_remaining (next_connect_attempt); |
410 | if (delay.rel_value > 0) | 410 | if (delay.rel_value_us > 0) |
411 | { | 411 | { |
412 | pos->attempt_connect_task = GNUNET_SCHEDULER_add_delayed (delay, | 412 | pos->attempt_connect_task = GNUNET_SCHEDULER_add_delayed (delay, |
413 | &do_attempt_connect, | 413 | &do_attempt_connect, |
@@ -450,7 +450,7 @@ remove_from_greylist (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
450 | 450 | ||
451 | pos->greylist_clean_task = GNUNET_SCHEDULER_NO_TASK; | 451 | pos->greylist_clean_task = GNUNET_SCHEDULER_NO_TASK; |
452 | rem = GNUNET_TIME_absolute_get_remaining (pos->greylisted_until); | 452 | rem = GNUNET_TIME_absolute_get_remaining (pos->greylisted_until); |
453 | if (rem.rel_value == 0) | 453 | if (0 == rem.rel_value_us) |
454 | { | 454 | { |
455 | schedule_attempt_connect (pos); | 455 | schedule_attempt_connect (pos); |
456 | } | 456 | } |
@@ -580,7 +580,7 @@ find_advertisable_hello (void *cls, const struct GNUNET_HashCode * pid, void *va | |||
580 | if (pos->hello == NULL) | 580 | if (pos->hello == NULL) |
581 | return GNUNET_YES; | 581 | return GNUNET_YES; |
582 | rst_time = GNUNET_TIME_absolute_get_remaining (pos->filter_expiration); | 582 | rst_time = GNUNET_TIME_absolute_get_remaining (pos->filter_expiration); |
583 | if (0 == rst_time.rel_value) | 583 | if (0 == rst_time.rel_value_us) |
584 | { | 584 | { |
585 | /* time to discard... */ | 585 | /* time to discard... */ |
586 | GNUNET_CONTAINER_bloomfilter_free (pos->filter); | 586 | GNUNET_CONTAINER_bloomfilter_free (pos->filter); |
@@ -631,7 +631,7 @@ schedule_next_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
631 | return; | 631 | return; |
632 | next_want = GNUNET_HELLO_size (fah.result->hello); | 632 | next_want = GNUNET_HELLO_size (fah.result->hello); |
633 | delay = GNUNET_TIME_absolute_get_remaining (pl->next_hello_allowed); | 633 | delay = GNUNET_TIME_absolute_get_remaining (pl->next_hello_allowed); |
634 | if (delay.rel_value == 0) | 634 | if (0 == delay.rel_value_us) |
635 | { | 635 | { |
636 | /* now! */ | 636 | /* now! */ |
637 | pl->hello_req = | 637 | pl->hello_req = |
@@ -708,7 +708,7 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
708 | else | 708 | else |
709 | { | 709 | { |
710 | GNUNET_assert (GNUNET_NO == pos->is_connected); | 710 | GNUNET_assert (GNUNET_NO == pos->is_connected); |
711 | pos->greylisted_until.abs_value = 0; /* remove greylisting */ | 711 | pos->greylisted_until.abs_value_us = 0; /* remove greylisting */ |
712 | } | 712 | } |
713 | pos->is_connected = GNUNET_YES; | 713 | pos->is_connected = GNUNET_YES; |
714 | pos->connect_attempts = 0; /* re-set back-off factor */ | 714 | pos->connect_attempts = 0; /* re-set back-off factor */ |
@@ -870,7 +870,7 @@ consider_for_advertising (const struct GNUNET_HELLO_Message *hello) | |||
870 | else if (peer->hello != NULL) | 870 | else if (peer->hello != NULL) |
871 | { | 871 | { |
872 | dt = GNUNET_HELLO_equals (peer->hello, hello, GNUNET_TIME_absolute_get ()); | 872 | dt = GNUNET_HELLO_equals (peer->hello, hello, GNUNET_TIME_absolute_get ()); |
873 | if (dt.abs_value == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value) | 873 | if (dt.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) |
874 | return; /* nothing new here */ | 874 | return; /* nothing new here */ |
875 | } | 875 | } |
876 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 876 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -940,7 +940,7 @@ process_peer (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
940 | if ((GNUNET_NO == pos->is_connected) && (GNUNET_NO == pos->is_friend) && | 940 | if ((GNUNET_NO == pos->is_connected) && (GNUNET_NO == pos->is_friend) && |
941 | (0 == | 941 | (0 == |
942 | GNUNET_TIME_absolute_get_remaining (pos-> | 942 | GNUNET_TIME_absolute_get_remaining (pos-> |
943 | greylisted_until).rel_value)) | 943 | greylisted_until).rel_value_us)) |
944 | free_peer (NULL, &pos->pid.hashPubKey, pos); | 944 | free_peer (NULL, &pos->pid.hashPubKey, pos); |
945 | } | 945 | } |
946 | return; | 946 | return; |
@@ -956,7 +956,7 @@ process_peer (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
956 | GNUNET_i2s (peer)); | 956 | GNUNET_i2s (peer)); |
957 | return; | 957 | return; |
958 | } | 958 | } |
959 | if (GNUNET_TIME_absolute_get_remaining (pos->greylisted_until).rel_value > 0) | 959 | if (GNUNET_TIME_absolute_get_remaining (pos->greylisted_until).rel_value_us > 0) |
960 | { | 960 | { |
961 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Already tried peer `%s' recently\n", | 961 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Already tried peer `%s' recently\n", |
962 | GNUNET_i2s (peer)); | 962 | GNUNET_i2s (peer)); |
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index f9585e512..2d939af36 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -286,8 +286,9 @@ GST_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
286 | } | 286 | } |
287 | end: | 287 | end: |
288 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 288 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
289 | "Allowing receive from peer %s to continue in %llu ms\n", | 289 | "Allowing receive from peer %s to continue in %s\n", |
290 | GNUNET_i2s (peer), (unsigned long long) ret.rel_value); | 290 | GNUNET_i2s (peer), |
291 | GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES)); | ||
291 | return ret; | 292 | return ret; |
292 | } | 293 | } |
293 | 294 | ||
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c index 4a9414622..0ca732d62 100644 --- a/src/transport/gnunet-service-transport_manipulation.c +++ b/src/transport/gnunet-service-transport_manipulation.c | |||
@@ -419,7 +419,7 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg | |||
419 | if (UINT32_MAX != find_metric(tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND)) | 419 | if (UINT32_MAX != find_metric(tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND)) |
420 | { | 420 | { |
421 | /* We have a delay */ | 421 | /* We have a delay */ |
422 | delay.rel_value = find_metric(tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND); | 422 | delay.rel_value_us = find_metric (tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND); |
423 | dqe = GNUNET_malloc (sizeof (struct DelayQueueEntry) + msg_size); | 423 | dqe = GNUNET_malloc (sizeof (struct DelayQueueEntry) + msg_size); |
424 | dqe->id = *target; | 424 | dqe->id = *target; |
425 | dqe->tmp = tmp; | 425 | dqe->tmp = tmp; |
@@ -434,8 +434,9 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg | |||
434 | if (GNUNET_SCHEDULER_NO_TASK == tmp->send_delay_task) | 434 | if (GNUNET_SCHEDULER_NO_TASK == tmp->send_delay_task) |
435 | tmp->send_delay_task =GNUNET_SCHEDULER_add_delayed (delay, &send_delayed, dqe); | 435 | tmp->send_delay_task =GNUNET_SCHEDULER_add_delayed (delay, &send_delayed, dqe); |
436 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 436 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
437 | "Delaying %u byte message to peer `%s' with generic delay for %llu ms\n", | 437 | "Delaying %u byte message to peer `%s' with generic delay for %ms\n", |
438 | msg_size, GNUNET_i2s (target), (long long unsigned int) delay.rel_value); | 438 | msg_size, GNUNET_i2s (target), |
439 | GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); | ||
439 | return; | 440 | return; |
440 | } | 441 | } |
441 | } | 442 | } |
@@ -443,7 +444,7 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg | |||
443 | { | 444 | { |
444 | GNUNET_break (GNUNET_YES == GST_neighbours_test_connected(target)); | 445 | GNUNET_break (GNUNET_YES == GST_neighbours_test_connected(target)); |
445 | /* We have a delay */ | 446 | /* We have a delay */ |
446 | delay.rel_value = find_metric (&man_handle.general, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND); | 447 | delay.rel_value_us = find_metric (&man_handle.general, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND); |
447 | dqe = GNUNET_malloc (sizeof (struct DelayQueueEntry) + msg_size); | 448 | dqe = GNUNET_malloc (sizeof (struct DelayQueueEntry) + msg_size); |
448 | dqe->id = *target; | 449 | dqe->id = *target; |
449 | dqe->tmp = NULL; | 450 | dqe->tmp = NULL; |
@@ -460,8 +461,9 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target, const void *msg | |||
460 | generic_send_delay_task = GNUNET_SCHEDULER_add_delayed (delay, &send_delayed, dqe); | 461 | generic_send_delay_task = GNUNET_SCHEDULER_add_delayed (delay, &send_delayed, dqe); |
461 | } | 462 | } |
462 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 463 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
463 | "Delaying %u byte message to peer `%s' with peer specific delay for %llu ms\n", | 464 | "Delaying %u byte message to peer `%s' with peer specific delay for %s\n", |
464 | msg_size, GNUNET_i2s (target), (long long unsigned int) delay.rel_value); | 465 | msg_size, GNUNET_i2s (target), |
466 | GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); | ||
465 | return; | 467 | return; |
466 | } | 468 | } |
467 | 469 | ||
@@ -540,28 +542,29 @@ GST_manipulation_recv (void *cls, | |||
540 | struct GNUNET_TIME_Relative m_delay; | 542 | struct GNUNET_TIME_Relative m_delay; |
541 | 543 | ||
542 | g_recv_delay = find_metric (&man_handle.general, GNUNET_ATS_QUALITY_NET_DELAY, TM_RECEIVE); | 544 | g_recv_delay = find_metric (&man_handle.general, GNUNET_ATS_QUALITY_NET_DELAY, TM_RECEIVE); |
543 | if ((g_recv_delay >= GNUNET_TIME_UNIT_ZERO.rel_value) && (UINT32_MAX != g_recv_delay)) | 545 | if ((g_recv_delay >= GNUNET_TIME_UNIT_ZERO.rel_value_us) && (UINT32_MAX != g_recv_delay)) |
544 | m_delay.rel_value = g_recv_delay; /* Global delay */ | 546 | m_delay.rel_value_us = g_recv_delay; /* Global delay */ |
545 | else | 547 | else |
546 | m_delay = GNUNET_TIME_UNIT_ZERO; | 548 | m_delay = GNUNET_TIME_UNIT_ZERO; |
547 | 549 | ||
548 | if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey))) | 550 | if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey))) |
549 | { | 551 | { |
550 | /* Manipulate receive delay */ | 552 | /* Manipulate receive delay */ |
551 | p_recv_delay = find_metric (tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_RECEIVE); | 553 | p_recv_delay = find_metric (tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_RECEIVE); |
552 | if (UINT32_MAX != p_recv_delay) | 554 | if (UINT32_MAX != p_recv_delay) |
553 | m_delay.rel_value = p_recv_delay; /* Peer specific delay */ | 555 | m_delay.rel_value_us = p_recv_delay; /* Peer specific delay */ |
554 | } | 556 | } |
555 | 557 | ||
556 | quota_delay = GST_receive_callback (cls, peer, message, | 558 | quota_delay = GST_receive_callback (cls, peer, message, |
557 | session, sender_address, sender_address_len); | 559 | session, sender_address, sender_address_len); |
558 | 560 | ||
559 | if (quota_delay.rel_value > m_delay.rel_value) | 561 | if (quota_delay.rel_value_us > m_delay.rel_value_us) |
560 | m_delay = quota_delay; | 562 | m_delay = quota_delay; |
561 | 563 | ||
562 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 564 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
563 | "Delaying next receive for peer `%s' for %llu ms\n", | 565 | "Delaying next receive for peer `%s' for %s\n", |
564 | GNUNET_i2s (peer), (long long unsigned int) m_delay.rel_value); | 566 | GNUNET_i2s (peer), |
567 | GNUNET_STRINGS_relative_time_to_string (m_delay, GNUNET_YES)); | ||
565 | return m_delay; | 568 | return m_delay; |
566 | 569 | ||
567 | } | 570 | } |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 8f53b93be..f09641506 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2010,2011,2012 Christian Grothoff (and other contributing authors) | 3 | (C) 2010-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -155,7 +155,7 @@ print_allocators () | |||
155 | next = GNUNET_TIME_UNIT_ZERO_ABS; | 155 | next = GNUNET_TIME_UNIT_ZERO_ABS; |
156 | start = GNUNET_NO; | 156 | start = GNUNET_NO; |
157 | } | 157 | } |
158 | if (0 == (rem = GNUNET_TIME_absolute_get_remaining(next)).rel_value) | 158 | if (0 == (rem = GNUNET_TIME_absolute_get_remaining(next)).rel_value_us) |
159 | { | 159 | { |
160 | fprintf (stderr, "Allocated in `%s' total: %5u bytes\n", __FILE__, bytes_alloced); | 160 | fprintf (stderr, "Allocated in `%s' total: %5u bytes\n", __FILE__, bytes_alloced); |
161 | while (NULL != cur) | 161 | while (NULL != cur) |
@@ -1406,7 +1406,7 @@ try_transmission_to_peer (struct NeighbourMapEntry *n) | |||
1406 | while (NULL != (mq = n->messages_head)) | 1406 | while (NULL != (mq = n->messages_head)) |
1407 | { | 1407 | { |
1408 | timeout = GNUNET_TIME_absolute_get_remaining (mq->timeout); | 1408 | timeout = GNUNET_TIME_absolute_get_remaining (mq->timeout); |
1409 | if (timeout.rel_value > 0) | 1409 | if (timeout.rel_value_us > 0) |
1410 | break; | 1410 | break; |
1411 | GNUNET_STATISTICS_update (GST_stats, | 1411 | GNUNET_STATISTICS_update (GST_stats, |
1412 | gettext_noop | 1412 | gettext_noop |
@@ -1443,7 +1443,7 @@ send_keepalive (struct NeighbourMapEntry *n) | |||
1443 | GNUNET_assert ((S_CONNECTED == n->state) || | 1443 | GNUNET_assert ((S_CONNECTED == n->state) || |
1444 | (S_CONNECTED_SWITCHING_BLACKLIST == n->state) || | 1444 | (S_CONNECTED_SWITCHING_BLACKLIST == n->state) || |
1445 | (S_CONNECTED_SWITCHING_CONNECT_SENT)); | 1445 | (S_CONNECTED_SWITCHING_CONNECT_SENT)); |
1446 | if (GNUNET_TIME_absolute_get_remaining (n->keep_alive_time).rel_value > 0) | 1446 | if (GNUNET_TIME_absolute_get_remaining (n->keep_alive_time).rel_value_us > 0) |
1447 | return; /* no keepalive needed at this time */ | 1447 | return; /* no keepalive needed at this time */ |
1448 | m.size = htons (sizeof (struct GNUNET_MessageHeader)); | 1448 | m.size = htons (sizeof (struct GNUNET_MessageHeader)); |
1449 | m.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE); | 1449 | m.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE); |
@@ -1534,14 +1534,16 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour) | |||
1534 | n->latency = GNUNET_TIME_absolute_get_duration (n->last_keep_alive_time); | 1534 | n->latency = GNUNET_TIME_absolute_get_duration (n->last_keep_alive_time); |
1535 | n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | 1535 | n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
1536 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1536 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1537 | "Latency for peer `%s' is %llu ms\n", | 1537 | "Latency for peer `%s' is %s\n", |
1538 | GNUNET_i2s (&n->id), n->latency.rel_value); | 1538 | GNUNET_i2s (&n->id), |
1539 | GNUNET_STRINGS_relative_time_to_string (n->latency, | ||
1540 | GNUNET_YES)); | ||
1539 | /* append latency */ | 1541 | /* append latency */ |
1540 | ats.type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); | 1542 | ats.type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); |
1541 | if (n->latency.rel_value > UINT32_MAX) | 1543 | if (n->latency.rel_value_us > UINT32_MAX) |
1542 | latency = UINT32_MAX; | 1544 | latency = UINT32_MAX; |
1543 | else | 1545 | else |
1544 | latency = n->latency.rel_value; | 1546 | latency = n->latency.rel_value_us; |
1545 | ats.value = htonl (latency); | 1547 | ats.value = htonl (latency); |
1546 | GST_ats_update_metrics (&n->id, | 1548 | GST_ats_update_metrics (&n->id, |
1547 | n->primary_address.address, | 1549 | n->primary_address.address, |
@@ -1622,17 +1624,18 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity | |||
1622 | } | 1624 | } |
1623 | *do_forward = GNUNET_YES; | 1625 | *do_forward = GNUNET_YES; |
1624 | ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 32 * 1024); | 1626 | ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 32 * 1024); |
1625 | if (ret.rel_value > 0) | 1627 | if (ret.rel_value_us > 0) |
1626 | { | 1628 | { |
1627 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1629 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1628 | "Throttling read (%llu bytes excess at %u b/s), waiting %llu ms before reading more.\n", | 1630 | "Throttling read (%llu bytes excess at %u b/s), waiting %s before reading more.\n", |
1629 | (unsigned long long) n->in_tracker. | 1631 | (unsigned long long) n->in_tracker. |
1630 | consumption_since_last_update__, | 1632 | consumption_since_last_update__, |
1631 | (unsigned int) n->in_tracker.available_bytes_per_s__, | 1633 | (unsigned int) n->in_tracker.available_bytes_per_s__, |
1632 | (unsigned long long) ret.rel_value); | 1634 | GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES)); |
1633 | GNUNET_STATISTICS_update (GST_stats, | 1635 | GNUNET_STATISTICS_update (GST_stats, |
1634 | gettext_noop ("# ms throttling suggested"), | 1636 | gettext_noop ("# ms throttling suggested"), |
1635 | (int64_t) ret.rel_value, GNUNET_NO); | 1637 | (int64_t) ret.rel_value_us / 1000LL, |
1638 | GNUNET_NO); | ||
1636 | } | 1639 | } |
1637 | return ret; | 1640 | return ret; |
1638 | } | 1641 | } |
@@ -2526,10 +2529,11 @@ master_task (void *cls, | |||
2526 | n->task = GNUNET_SCHEDULER_NO_TASK; | 2529 | n->task = GNUNET_SCHEDULER_NO_TASK; |
2527 | delay = GNUNET_TIME_absolute_get_remaining (n->timeout); | 2530 | delay = GNUNET_TIME_absolute_get_remaining (n->timeout); |
2528 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2531 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2529 | "Master task runs for neighbour `%s' in state %s with timeout in %llu ms\n", | 2532 | "Master task runs for neighbour `%s' in state %s with timeout in %s\n", |
2530 | GNUNET_i2s (&n->id), | 2533 | GNUNET_i2s (&n->id), |
2531 | print_state(n->state), | 2534 | print_state(n->state), |
2532 | (unsigned long long) delay.rel_value); | 2535 | GNUNET_STRINGS_relative_time_to_string (delay, |
2536 | GNUNET_YES)); | ||
2533 | switch (n->state) | 2537 | switch (n->state) |
2534 | { | 2538 | { |
2535 | case S_NOT_CONNECTED: | 2539 | case S_NOT_CONNECTED: |
@@ -2539,7 +2543,7 @@ master_task (void *cls, | |||
2539 | free_neighbour (n, GNUNET_NO); | 2543 | free_neighbour (n, GNUNET_NO); |
2540 | return; | 2544 | return; |
2541 | case S_INIT_ATS: | 2545 | case S_INIT_ATS: |
2542 | if (0 == delay.rel_value) | 2546 | if (0 == delay.rel_value_us) |
2543 | { | 2547 | { |
2544 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2548 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2545 | "Connection to `%s' timed out waiting for ATS to provide address\n", | 2549 | "Connection to `%s' timed out waiting for ATS to provide address\n", |
@@ -2550,7 +2554,7 @@ master_task (void *cls, | |||
2550 | } | 2554 | } |
2551 | break; | 2555 | break; |
2552 | case S_INIT_BLACKLIST: | 2556 | case S_INIT_BLACKLIST: |
2553 | if (0 == delay.rel_value) | 2557 | if (0 == delay.rel_value_us) |
2554 | { | 2558 | { |
2555 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2559 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2556 | "Connection to `%s' timed out waiting for BLACKLIST to approve address\n", | 2560 | "Connection to `%s' timed out waiting for BLACKLIST to approve address\n", |
@@ -2561,7 +2565,7 @@ master_task (void *cls, | |||
2561 | } | 2565 | } |
2562 | break; | 2566 | break; |
2563 | case S_CONNECT_SENT: | 2567 | case S_CONNECT_SENT: |
2564 | if (0 == delay.rel_value) | 2568 | if (0 == delay.rel_value_us) |
2565 | { | 2569 | { |
2566 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2570 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2567 | "Connection to `%s' timed out waiting for other peer to send CONNECT_ACK\n", | 2571 | "Connection to `%s' timed out waiting for other peer to send CONNECT_ACK\n", |
@@ -2571,7 +2575,7 @@ master_task (void *cls, | |||
2571 | } | 2575 | } |
2572 | break; | 2576 | break; |
2573 | case S_CONNECT_RECV_BLACKLIST_INBOUND: | 2577 | case S_CONNECT_RECV_BLACKLIST_INBOUND: |
2574 | if (0 == delay.rel_value) | 2578 | if (0 == delay.rel_value_us) |
2575 | { | 2579 | { |
2576 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2580 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2577 | "Connection to `%s' timed out waiting BLACKLIST to approve address to use for received CONNECT\n", | 2581 | "Connection to `%s' timed out waiting BLACKLIST to approve address to use for received CONNECT\n", |
@@ -2582,7 +2586,7 @@ master_task (void *cls, | |||
2582 | } | 2586 | } |
2583 | break; | 2587 | break; |
2584 | case S_CONNECT_RECV_ATS: | 2588 | case S_CONNECT_RECV_ATS: |
2585 | if (0 == delay.rel_value) | 2589 | if (0 == delay.rel_value_us) |
2586 | { | 2590 | { |
2587 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2591 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2588 | "Connection to `%s' timed out waiting ATS to provide address to use for CONNECT_ACK\n", | 2592 | "Connection to `%s' timed out waiting ATS to provide address to use for CONNECT_ACK\n", |
@@ -2593,7 +2597,7 @@ master_task (void *cls, | |||
2593 | } | 2597 | } |
2594 | break; | 2598 | break; |
2595 | case S_CONNECT_RECV_BLACKLIST: | 2599 | case S_CONNECT_RECV_BLACKLIST: |
2596 | if (0 == delay.rel_value) | 2600 | if (0 == delay.rel_value_us) |
2597 | { | 2601 | { |
2598 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2602 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2599 | "Connection to `%s' timed out waiting BLACKLIST to approve address to use for CONNECT_ACK\n", | 2603 | "Connection to `%s' timed out waiting BLACKLIST to approve address to use for CONNECT_ACK\n", |
@@ -2604,7 +2608,7 @@ master_task (void *cls, | |||
2604 | } | 2608 | } |
2605 | break; | 2609 | break; |
2606 | case S_CONNECT_RECV_ACK: | 2610 | case S_CONNECT_RECV_ACK: |
2607 | if (0 == delay.rel_value) | 2611 | if (0 == delay.rel_value_us) |
2608 | { | 2612 | { |
2609 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2613 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2610 | "Connection to `%s' timed out waiting for other peer to send SESSION_ACK\n", | 2614 | "Connection to `%s' timed out waiting for other peer to send SESSION_ACK\n", |
@@ -2614,7 +2618,7 @@ master_task (void *cls, | |||
2614 | } | 2618 | } |
2615 | break; | 2619 | break; |
2616 | case S_CONNECTED: | 2620 | case S_CONNECTED: |
2617 | if (0 == delay.rel_value) | 2621 | if (0 == delay.rel_value_us) |
2618 | { | 2622 | { |
2619 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2623 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2620 | "Connection to `%s' timed out, missing KEEPALIVE_RESPONSEs\n", | 2624 | "Connection to `%s' timed out, missing KEEPALIVE_RESPONSEs\n", |
@@ -2626,7 +2630,7 @@ master_task (void *cls, | |||
2626 | send_keepalive (n); | 2630 | send_keepalive (n); |
2627 | break; | 2631 | break; |
2628 | case S_RECONNECT_ATS: | 2632 | case S_RECONNECT_ATS: |
2629 | if (0 == delay.rel_value) | 2633 | if (0 == delay.rel_value_us) |
2630 | { | 2634 | { |
2631 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2635 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2632 | "Connection to `%s' timed out, waiting for ATS replacement address\n", | 2636 | "Connection to `%s' timed out, waiting for ATS replacement address\n", |
@@ -2636,7 +2640,7 @@ master_task (void *cls, | |||
2636 | } | 2640 | } |
2637 | break; | 2641 | break; |
2638 | case S_RECONNECT_BLACKLIST: | 2642 | case S_RECONNECT_BLACKLIST: |
2639 | if (0 == delay.rel_value) | 2643 | if (0 == delay.rel_value_us) |
2640 | { | 2644 | { |
2641 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2645 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2642 | "Connection to `%s' timed out, waiting for BLACKLIST to approve replacement address\n", | 2646 | "Connection to `%s' timed out, waiting for BLACKLIST to approve replacement address\n", |
@@ -2646,7 +2650,7 @@ master_task (void *cls, | |||
2646 | } | 2650 | } |
2647 | break; | 2651 | break; |
2648 | case S_RECONNECT_SENT: | 2652 | case S_RECONNECT_SENT: |
2649 | if (0 == delay.rel_value) | 2653 | if (0 == delay.rel_value_us) |
2650 | { | 2654 | { |
2651 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2655 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2652 | "Connection to `%s' timed out, waiting for other peer to CONNECT_ACK replacement address\n", | 2656 | "Connection to `%s' timed out, waiting for other peer to CONNECT_ACK replacement address\n", |
@@ -2656,7 +2660,7 @@ master_task (void *cls, | |||
2656 | } | 2660 | } |
2657 | break; | 2661 | break; |
2658 | case S_CONNECTED_SWITCHING_BLACKLIST: | 2662 | case S_CONNECTED_SWITCHING_BLACKLIST: |
2659 | if (0 == delay.rel_value) | 2663 | if (0 == delay.rel_value_us) |
2660 | { | 2664 | { |
2661 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2665 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2662 | "Connection to `%s' timed out, missing KEEPALIVE_RESPONSEs\n", | 2666 | "Connection to `%s' timed out, missing KEEPALIVE_RESPONSEs\n", |
@@ -2668,7 +2672,7 @@ master_task (void *cls, | |||
2668 | send_keepalive (n); | 2672 | send_keepalive (n); |
2669 | break; | 2673 | break; |
2670 | case S_CONNECTED_SWITCHING_CONNECT_SENT: | 2674 | case S_CONNECTED_SWITCHING_CONNECT_SENT: |
2671 | if (0 == delay.rel_value) | 2675 | if (0 == delay.rel_value_us) |
2672 | { | 2676 | { |
2673 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2677 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2674 | "Connection to `%s' timed out, missing KEEPALIVE_RESPONSEs (after trying to CONNECT on alternative address)\n", | 2678 | "Connection to `%s' timed out, missing KEEPALIVE_RESPONSEs (after trying to CONNECT on alternative address)\n", |
@@ -2785,7 +2789,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, | |||
2785 | 1, GNUNET_NO); | 2789 | 1, GNUNET_NO); |
2786 | break; | 2790 | break; |
2787 | case S_CONNECT_SENT: | 2791 | case S_CONNECT_SENT: |
2788 | if (ts.abs_value != n->primary_address.connect_timestamp.abs_value) | 2792 | if (ts.abs_value_us != n->primary_address.connect_timestamp.abs_value_us) |
2789 | break; /* ACK does not match our original CONNECT message */ | 2793 | break; /* ACK does not match our original CONNECT message */ |
2790 | n->state = S_CONNECTED; | 2794 | n->state = S_CONNECTED; |
2791 | n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | 2795 | n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
@@ -3142,7 +3146,7 @@ GST_neighbours_handle_disconnect_message (const struct GNUNET_PeerIdentity | |||
3142 | sdm = (const struct SessionDisconnectMessage *) msg; | 3146 | sdm = (const struct SessionDisconnectMessage *) msg; |
3143 | if (NULL == (n = lookup_neighbour (peer))) | 3147 | if (NULL == (n = lookup_neighbour (peer))) |
3144 | return; /* gone already */ | 3148 | return; /* gone already */ |
3145 | if (GNUNET_TIME_absolute_ntoh (sdm->timestamp).abs_value <= n->connect_ack_timestamp.abs_value) | 3149 | if (GNUNET_TIME_absolute_ntoh (sdm->timestamp).abs_value_us <= n->connect_ack_timestamp.abs_value_us) |
3146 | { | 3150 | { |
3147 | GNUNET_STATISTICS_update (GST_stats, | 3151 | GNUNET_STATISTICS_update (GST_stats, |
3148 | gettext_noop | 3152 | gettext_noop |
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 0c70ee9bb..95a7eb04a 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2010,2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2010-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -444,7 +444,7 @@ timeout_hello_validation (void *cls, | |||
444 | ve->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 444 | ve->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
445 | max = GNUNET_TIME_absolute_max (ve->valid_until, ve->revalidation_block); | 445 | max = GNUNET_TIME_absolute_max (ve->valid_until, ve->revalidation_block); |
446 | left = GNUNET_TIME_absolute_get_remaining (max); | 446 | left = GNUNET_TIME_absolute_get_remaining (max); |
447 | if (left.rel_value > 0) | 447 | if (left.rel_value_us > 0) |
448 | { | 448 | { |
449 | /* should wait a bit longer */ | 449 | /* should wait a bit longer */ |
450 | ve->timeout_task = | 450 | ve->timeout_task = |
@@ -494,7 +494,7 @@ transmit_ping_if_allowed (void *cls, const struct GNUNET_PeerIdentity *pid, | |||
494 | GNUNET_i2s (pid), GST_plugins_a2s (ve->address), ve->address->transport_name); | 494 | GNUNET_i2s (pid), GST_plugins_a2s (ve->address), ve->address->transport_name); |
495 | 495 | ||
496 | next = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), validation_delay); | 496 | next = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), validation_delay); |
497 | if (next.abs_value > validation_next.abs_value) | 497 | if (next.abs_value_us > validation_next.abs_value_us) |
498 | validation_next = next; /* We're going to send a PING so delay next validation */ | 498 | validation_next = next; /* We're going to send a PING so delay next validation */ |
499 | 499 | ||
500 | slen = strlen (ve->address->transport_name) + 1; | 500 | slen = strlen (ve->address->transport_name) + 1; |
@@ -607,15 +607,15 @@ revalidate_address (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
607 | canonical_delay = | 607 | canonical_delay = |
608 | (ve->in_use == | 608 | (ve->in_use == |
609 | GNUNET_YES) ? CONNECTED_PING_FREQUENCY | 609 | GNUNET_YES) ? CONNECTED_PING_FREQUENCY |
610 | : ((GNUNET_TIME_absolute_get_remaining (ve->valid_until).rel_value > | 610 | : ((GNUNET_TIME_absolute_get_remaining (ve->valid_until).rel_value_us > |
611 | 0) ? VALIDATED_PING_FREQUENCY : UNVALIDATED_PING_KEEPALIVE); | 611 | 0) ? VALIDATED_PING_FREQUENCY : UNVALIDATED_PING_KEEPALIVE); |
612 | if (delay.rel_value > canonical_delay.rel_value * 2) | 612 | if (delay.rel_value_us > canonical_delay.rel_value_us * 2) |
613 | { | 613 | { |
614 | /* situation changed, recalculate delay */ | 614 | /* situation changed, recalculate delay */ |
615 | delay = canonical_delay; | 615 | delay = canonical_delay; |
616 | ve->revalidation_block = GNUNET_TIME_relative_to_absolute (delay); | 616 | ve->revalidation_block = GNUNET_TIME_relative_to_absolute (delay); |
617 | } | 617 | } |
618 | if (delay.rel_value > 0) | 618 | if (delay.rel_value_us > 0) |
619 | { | 619 | { |
620 | /* should wait a bit longer */ | 620 | /* should wait a bit longer */ |
621 | ve->revalidation_task = | 621 | ve->revalidation_task = |
@@ -624,7 +624,7 @@ revalidate_address (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
624 | } | 624 | } |
625 | blocked_for = GNUNET_TIME_absolute_get_remaining(validation_next); | 625 | blocked_for = GNUNET_TIME_absolute_get_remaining(validation_next); |
626 | if ((validations_running > validations_fast_start_threshold) && | 626 | if ((validations_running > validations_fast_start_threshold) && |
627 | (blocked_for.rel_value > 0)) | 627 | (blocked_for.rel_value_us > 0)) |
628 | { | 628 | { |
629 | /* Validations are blocked, have to wait for blocked_for time */ | 629 | /* Validations are blocked, have to wait for blocked_for time */ |
630 | ve->revalidation_task = | 630 | ve->revalidation_task = |
@@ -636,24 +636,20 @@ revalidate_address (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
636 | /* schedule next PINGing with some extra random delay to avoid synchronous re-validations */ | 636 | /* schedule next PINGing with some extra random delay to avoid synchronous re-validations */ |
637 | rdelay = | 637 | rdelay = |
638 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 638 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
639 | canonical_delay.rel_value); | 639 | canonical_delay.rel_value_us); |
640 | 640 | ||
641 | /* Debug code for mantis 0002726*/ | 641 | /* Debug code for mantis 0002726 */ |
642 | if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value == | 642 | if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == |
643 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, rdelay).rel_value) | 643 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS, rdelay).rel_value_us) |
644 | { | 644 | { |
645 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 645 | GNUNET_break (0); |
646 | "Revalidation interval for peer `%s' for is FOREVER (debug: rdelay: %llu, canonical delay %llu)\n", | ||
647 | GNUNET_i2s (&ve->pid), | ||
648 | (unsigned long long) delay.rel_value, | ||
649 | (unsigned long long) canonical_delay.rel_value); | ||
650 | delay = canonical_delay; | 646 | delay = canonical_delay; |
651 | } | 647 | } |
652 | else | 648 | else |
653 | { | 649 | { |
654 | delay = GNUNET_TIME_relative_add (canonical_delay, | 650 | delay = GNUNET_TIME_relative_add (canonical_delay, |
655 | GNUNET_TIME_relative_multiply | 651 | GNUNET_TIME_relative_multiply |
656 | (GNUNET_TIME_UNIT_MILLISECONDS, rdelay)); | 652 | (GNUNET_TIME_UNIT_MICROSECONDS, rdelay)); |
657 | } | 653 | } |
658 | /* End debug code for mantis 0002726*/ | 654 | /* End debug code for mantis 0002726*/ |
659 | ve->revalidation_task = | 655 | ve->revalidation_task = |
@@ -739,7 +735,7 @@ add_valid_address (void *cls, const struct GNUNET_HELLO_Address *address, | |||
739 | struct GNUNET_ATS_Information ats; | 735 | struct GNUNET_ATS_Information ats; |
740 | struct GNUNET_CRYPTO_EccPublicKey public_key; | 736 | struct GNUNET_CRYPTO_EccPublicKey public_key; |
741 | 737 | ||
742 | if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value == 0) | 738 | if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us) |
743 | return GNUNET_OK; /* expired */ | 739 | return GNUNET_OK; /* expired */ |
744 | if ((GNUNET_OK != GNUNET_HELLO_get_id (hello, &pid)) || | 740 | if ((GNUNET_OK != GNUNET_HELLO_get_id (hello, &pid)) || |
745 | (GNUNET_OK != GNUNET_HELLO_get_key (hello, &public_key))) | 741 | (GNUNET_OK != GNUNET_HELLO_get_key (hello, &public_key))) |
@@ -806,16 +802,18 @@ GST_validation_start (unsigned int max_fds) | |||
806 | * when doing to many validations in parallel: | 802 | * when doing to many validations in parallel: |
807 | * if (running validations < (max_fds / 2)) | 803 | * if (running validations < (max_fds / 2)) |
808 | * - "fast start": run validation immediately | 804 | * - "fast start": run validation immediately |
809 | * - have delay of (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value) / (max_fds / 2) | 805 | * - have delay of (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value_us) / (max_fds / 2) |
810 | * (300 sec / ~150 == ~2 sec.) between two validations | 806 | * (300 sec / ~150 == ~2 sec.) between two validations |
811 | */ | 807 | */ |
812 | 808 | ||
813 | validation_next = GNUNET_TIME_absolute_get(); | 809 | validation_next = GNUNET_TIME_absolute_get(); |
814 | validation_delay.rel_value = (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value) / (max_fds / 2); | 810 | validation_delay.rel_value_us = (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value_us) / (max_fds / 2); |
815 | validations_fast_start_threshold = (max_fds / 2); | 811 | validations_fast_start_threshold = (max_fds / 2); |
816 | validations_running = 0; | 812 | validations_running = 0; |
817 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Validation uses a fast start threshold of %u connections and a delay between of %u ms\n ", | 813 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Validation uses a fast start threshold of %u connections and a delay between of %s\n ", |
818 | validations_fast_start_threshold, validation_delay.rel_value); | 814 | validations_fast_start_threshold, |
815 | GNUNET_STRINGS_relative_time_to_string (validation_delay, | ||
816 | GNUNET_YES)); | ||
819 | validation_map = GNUNET_CONTAINER_multihashmap_create (VALIDATION_MAP_SIZE, | 817 | validation_map = GNUNET_CONTAINER_multihashmap_create (VALIDATION_MAP_SIZE, |
820 | GNUNET_NO); | 818 | GNUNET_NO); |
821 | pnc = GNUNET_PEERINFO_notify (GST_cfg, GNUNET_YES, &process_peerinfo_hello, NULL); | 819 | pnc = GNUNET_PEERINFO_notify (GST_cfg, GNUNET_YES, &process_peerinfo_hello, NULL); |
@@ -1056,8 +1054,8 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
1056 | GNUNET_assert (NULL != addrend); | 1054 | GNUNET_assert (NULL != addrend); |
1057 | memcpy (&((char *) &pong[1])[slen], addrend, alen); | 1055 | memcpy (&((char *) &pong[1])[slen], addrend, alen); |
1058 | } | 1056 | } |
1059 | if (GNUNET_TIME_absolute_get_remaining (*sig_cache_exp).rel_value < | 1057 | if (GNUNET_TIME_absolute_get_remaining (*sig_cache_exp).rel_value_us < |
1060 | PONG_SIGNATURE_LIFETIME.rel_value / 4) | 1058 | PONG_SIGNATURE_LIFETIME.rel_value_us / 4) |
1061 | { | 1059 | { |
1062 | /* create / update cached sig */ | 1060 | /* create / update cached sig */ |
1063 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1061 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1164,7 +1162,7 @@ validate_address_iterator (void *cls, | |||
1164 | const struct ValidateAddressContext *vac = cls; | 1162 | const struct ValidateAddressContext *vac = cls; |
1165 | struct ValidationEntry *ve; | 1163 | struct ValidationEntry *ve; |
1166 | 1164 | ||
1167 | if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value == 0) | 1165 | if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us) |
1168 | return GNUNET_OK; /* expired */ | 1166 | return GNUNET_OK; /* expired */ |
1169 | ve = find_validation_entry (&vac->public_key, address); | 1167 | ve = find_validation_entry (&vac->public_key, address); |
1170 | if (GNUNET_SCHEDULER_NO_TASK == ve->revalidation_task) | 1168 | if (GNUNET_SCHEDULER_NO_TASK == ve->revalidation_task) |
@@ -1261,7 +1259,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
1261 | return; | 1259 | return; |
1262 | } | 1260 | } |
1263 | if (GNUNET_TIME_absolute_get_remaining | 1261 | if (GNUNET_TIME_absolute_get_remaining |
1264 | (GNUNET_TIME_absolute_ntoh (pong->expiration)).rel_value == 0) | 1262 | (GNUNET_TIME_absolute_ntoh (pong->expiration)).rel_value_us == 0) |
1265 | { | 1263 | { |
1266 | GNUNET_STATISTICS_update (GST_stats, | 1264 | GNUNET_STATISTICS_update (GST_stats, |
1267 | gettext_noop | 1265 | gettext_noop |
@@ -1272,7 +1270,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
1272 | 1270 | ||
1273 | sig_res = GNUNET_SYSERR; | 1271 | sig_res = GNUNET_SYSERR; |
1274 | do_verify = GNUNET_YES; | 1272 | do_verify = GNUNET_YES; |
1275 | if (0 != GNUNET_TIME_absolute_get_remaining(ve->pong_sig_valid_until).rel_value) | 1273 | if (0 != GNUNET_TIME_absolute_get_remaining(ve->pong_sig_valid_until).rel_value_us) |
1276 | { | 1274 | { |
1277 | /* We have a cached and valid signature for this peer, | 1275 | /* We have a cached and valid signature for this peer, |
1278 | * try to compare instead of verify */ | 1276 | * try to compare instead of verify */ |
@@ -1316,7 +1314,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
1316 | { | 1314 | { |
1317 | struct GNUNET_ATS_Information ats[2]; | 1315 | struct GNUNET_ATS_Information ats[2]; |
1318 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); | 1316 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); |
1319 | ats[0].value = htonl ((uint32_t) ve->latency.rel_value); | 1317 | ats[0].value = htonl ((uint32_t) ve->latency.rel_value_us); |
1320 | ats[1].type = htonl (GNUNET_ATS_NETWORK_TYPE); | 1318 | ats[1].type = htonl (GNUNET_ATS_NETWORK_TYPE); |
1321 | ats[1].value = htonl ((uint32_t) ve->network); | 1319 | ats[1].value = htonl ((uint32_t) ve->network); |
1322 | GNUNET_ATS_address_add (GST_ats, ve->address, NULL, ats, 2); | 1320 | GNUNET_ATS_address_add (GST_ats, ve->address, NULL, ats, 2); |
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index c03d6a388..641261c05 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c | |||
@@ -264,14 +264,14 @@ shutdown_task (void *cls, | |||
264 | { | 264 | { |
265 | duration = GNUNET_TIME_absolute_get_duration (start_time); | 265 | duration = GNUNET_TIME_absolute_get_duration (start_time); |
266 | FPRINTF (stdout, _("Transmitted %llu bytes/s (%llu bytes in %s)\n"), | 266 | FPRINTF (stdout, _("Transmitted %llu bytes/s (%llu bytes in %s)\n"), |
267 | 1000 * traffic_sent / (1 + duration.rel_value), traffic_sent, | 267 | 1000LL * 1000LL * traffic_sent / (1 + duration.rel_value_us), traffic_sent, |
268 | GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES)); | 268 | GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES)); |
269 | } | 269 | } |
270 | if (benchmark_receive) | 270 | if (benchmark_receive) |
271 | { | 271 | { |
272 | duration = GNUNET_TIME_absolute_get_duration (start_time); | 272 | duration = GNUNET_TIME_absolute_get_duration (start_time); |
273 | FPRINTF (stdout, _("Received %llu bytes/s (%llu bytes in %s)\n"), | 273 | FPRINTF (stdout, _("Received %llu bytes/s (%llu bytes in %s)\n"), |
274 | 1000 * traffic_received / (1 + duration.rel_value), | 274 | 1000LL * 1000LL * traffic_received / (1 + duration.rel_value_us), |
275 | traffic_received, | 275 | traffic_received, |
276 | GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES)); | 276 | GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES)); |
277 | } | 277 | } |
diff --git a/src/transport/plugin_transport_bluetooth.c b/src/transport/plugin_transport_bluetooth.c index 41500c34e..74fcd36a7 100644 --- a/src/transport/plugin_transport_bluetooth.c +++ b/src/transport/plugin_transport_bluetooth.c | |||
@@ -694,7 +694,7 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
694 | 694 | ||
695 | session->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 695 | session->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
696 | timeout = GNUNET_TIME_absolute_get_remaining (session->timeout); | 696 | timeout = GNUNET_TIME_absolute_get_remaining (session->timeout); |
697 | if (0 == timeout.rel_value) | 697 | if (0 == timeout.rel_value_us) |
698 | { | 698 | { |
699 | free_session (session); | 699 | free_session (session); |
700 | return; | 700 | return; |
@@ -970,7 +970,7 @@ macendpoint_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
970 | 970 | ||
971 | endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 971 | endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
972 | timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout); | 972 | timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout); |
973 | if (0 == timeout.rel_value) | 973 | if (0 == timeout.rel_value_us) |
974 | { | 974 | { |
975 | free_macendpoint (endpoint); | 975 | free_macendpoint (endpoint); |
976 | return; | 976 | return; |
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index 88ab5cfed..937f4f62f 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c | |||
@@ -1261,8 +1261,10 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1261 | 1261 | ||
1262 | s->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 1262 | s->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
1263 | GNUNET_log (TIMEOUT_LOG, | 1263 | GNUNET_log (TIMEOUT_LOG, |
1264 | "Session %p was idle for %llu ms, disconnecting\n", | 1264 | "Session %p was idle for %s, disconnecting\n", |
1265 | s, (unsigned long long) TIMEOUT.rel_value); | 1265 | s, |
1266 | GNUNET_STRINGS_relative_time_to_string (TIMEOUT, | ||
1267 | GNUNET_YES)); | ||
1266 | 1268 | ||
1267 | /* call session destroy function */ | 1269 | /* call session destroy function */ |
1268 | if (s->inbound == GNUNET_NO) | 1270 | if (s->inbound == GNUNET_NO) |
@@ -1284,8 +1286,10 @@ start_session_timeout (struct Session *s) | |||
1284 | &session_timeout, | 1286 | &session_timeout, |
1285 | s); | 1287 | s); |
1286 | GNUNET_log (TIMEOUT_LOG, | 1288 | GNUNET_log (TIMEOUT_LOG, |
1287 | "Timeout for session %p set to %llu ms\n", | 1289 | "Timeout for session %p set to %s\n", |
1288 | s, (unsigned long long) TIMEOUT.rel_value); | 1290 | s, |
1291 | GNUNET_STRINGS_relative_time_to_string (TIMEOUT, | ||
1292 | GNUNET_YES)); | ||
1289 | } | 1293 | } |
1290 | 1294 | ||
1291 | 1295 | ||
@@ -1303,8 +1307,10 @@ reschedule_session_timeout (struct Session *s) | |||
1303 | &session_timeout, | 1307 | &session_timeout, |
1304 | s); | 1308 | s); |
1305 | GNUNET_log (TIMEOUT_LOG, | 1309 | GNUNET_log (TIMEOUT_LOG, |
1306 | "Timeout rescheduled for session %p set to %llu ms\n", | 1310 | "Timeout rescheduled for session %p set to %s\n", |
1307 | s, (unsigned long long) TIMEOUT.rel_value); | 1311 | s, |
1312 | GNUNET_STRINGS_relative_time_to_String (TIMEOUT, | ||
1313 | GNUNET_YES)); | ||
1308 | } | 1314 | } |
1309 | 1315 | ||
1310 | 1316 | ||
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index 75daeab71..2d112d4fe 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c | |||
@@ -912,6 +912,7 @@ client_receive_mst_cb (void *cls, void *client, | |||
912 | struct GNUNET_TIME_Relative delay; | 912 | struct GNUNET_TIME_Relative delay; |
913 | struct GNUNET_ATS_Information atsi; | 913 | struct GNUNET_ATS_Information atsi; |
914 | char *stat_txt; | 914 | char *stat_txt; |
915 | |||
915 | if (GNUNET_YES != client_exist_session(p, s)) | 916 | if (GNUNET_YES != client_exist_session(p, s)) |
916 | { | 917 | { |
917 | GNUNET_break (0); | 918 | GNUNET_break (0); |
@@ -940,14 +941,16 @@ client_receive_mst_cb (void *cls, void *client, | |||
940 | s->next_receive = | 941 | s->next_receive = |
941 | GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay); | 942 | GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay); |
942 | 943 | ||
943 | if (GNUNET_TIME_absolute_get ().abs_value < s->next_receive.abs_value) | 944 | if (GNUNET_TIME_absolute_get ().abs_value_us < s->next_receive.abs_value_us) |
944 | { | 945 | { |
945 | |||
946 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 946 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
947 | "Client: peer `%s' address `%s' next read delayed for %llu ms\n", | 947 | "Client: peer `%s' address `%s' next read delayed for %s\n", |
948 | GNUNET_i2s (&s->target), | 948 | GNUNET_i2s (&s->target), |
949 | http_common_plugin_address_to_string (NULL, s->plugin->protocol, s->addr, s->addrlen), | 949 | http_common_plugin_address_to_string (NULL, |
950 | delay); | 950 | s->plugin->protocol, |
951 | s->addr, s->addrlen), | ||
952 | GNUNET_STRINGS_relative_time_to_string (delay, | ||
953 | GNUNET_YES)); | ||
951 | } | 954 | } |
952 | client_reschedule_session_timeout (s); | 955 | client_reschedule_session_timeout (s); |
953 | return GNUNET_OK; | 956 | return GNUNET_OK; |
@@ -993,14 +996,16 @@ client_receive (void *stream, size_t size, size_t nmemb, void *cls) | |||
993 | s, s->client_get, | 996 | s, s->client_get, |
994 | len, GNUNET_i2s (&s->target)); | 997 | len, GNUNET_i2s (&s->target)); |
995 | now = GNUNET_TIME_absolute_get (); | 998 | now = GNUNET_TIME_absolute_get (); |
996 | if (now.abs_value < s->next_receive.abs_value) | 999 | if (now.abs_value_us < s->next_receive.abs_value_us) |
997 | { | 1000 | { |
998 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); | 1001 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); |
999 | struct GNUNET_TIME_Relative delta = | 1002 | struct GNUNET_TIME_Relative delta = |
1000 | GNUNET_TIME_absolute_get_difference (now, s->next_receive); | 1003 | GNUNET_TIME_absolute_get_difference (now, s->next_receive); |
1001 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name, | 1004 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name, |
1002 | "Session %p / connection %p: No inbound bandwidth available! Next read was delayed for %llu ms\n", | 1005 | "Session %p / connection %p: No inbound bandwidth available! Next read was delayed for %s\n", |
1003 | s, s->client_get, delta.rel_value); | 1006 | s, s->client_get, |
1007 | GNUNET_STRINGS_relative_time_to_string (delta, | ||
1008 | GNUNET_YES)); | ||
1004 | if (s->recv_wakeup_task != GNUNET_SCHEDULER_NO_TASK) | 1009 | if (s->recv_wakeup_task != GNUNET_SCHEDULER_NO_TASK) |
1005 | { | 1010 | { |
1006 | GNUNET_SCHEDULER_cancel (s->recv_wakeup_task); | 1011 | GNUNET_SCHEDULER_cancel (s->recv_wakeup_task); |
@@ -1276,7 +1281,7 @@ client_connect_get (struct Session *s) | |||
1276 | curl_easy_setopt (s->client_get, CURLOPT_TIMEOUT, 0); | 1281 | curl_easy_setopt (s->client_get, CURLOPT_TIMEOUT, 0); |
1277 | curl_easy_setopt (s->client_get, CURLOPT_PRIVATE, s); | 1282 | curl_easy_setopt (s->client_get, CURLOPT_PRIVATE, s); |
1278 | curl_easy_setopt (s->client_get, CURLOPT_CONNECTTIMEOUT_MS, | 1283 | curl_easy_setopt (s->client_get, CURLOPT_CONNECTTIMEOUT_MS, |
1279 | (long) HTTP_CLIENT_NOT_VALIDATED_TIMEOUT.rel_value); | 1284 | (long) HTTP_CLIENT_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL); |
1280 | curl_easy_setopt (s->client_get, CURLOPT_BUFFERSIZE, | 1285 | curl_easy_setopt (s->client_get, CURLOPT_BUFFERSIZE, |
1281 | 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE); | 1286 | 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE); |
1282 | #if CURL_TCP_NODELAY | 1287 | #if CURL_TCP_NODELAY |
@@ -1353,7 +1358,7 @@ client_connect_put (struct Session *s) | |||
1353 | curl_easy_setopt (s->client_put, CURLOPT_TIMEOUT, 0); | 1358 | curl_easy_setopt (s->client_put, CURLOPT_TIMEOUT, 0); |
1354 | curl_easy_setopt (s->client_put, CURLOPT_PRIVATE, s); | 1359 | curl_easy_setopt (s->client_put, CURLOPT_PRIVATE, s); |
1355 | curl_easy_setopt (s->client_put, CURLOPT_CONNECTTIMEOUT_MS, | 1360 | curl_easy_setopt (s->client_put, CURLOPT_CONNECTTIMEOUT_MS, |
1356 | (long) HTTP_CLIENT_NOT_VALIDATED_TIMEOUT.rel_value); | 1361 | (long) HTTP_CLIENT_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL); |
1357 | curl_easy_setopt (s->client_put, CURLOPT_BUFFERSIZE, | 1362 | curl_easy_setopt (s->client_put, CURLOPT_BUFFERSIZE, |
1358 | 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE); | 1363 | 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE); |
1359 | #if CURL_TCP_NODELAY | 1364 | #if CURL_TCP_NODELAY |
@@ -1597,8 +1602,10 @@ client_session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
1597 | 1602 | ||
1598 | s->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 1603 | s->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
1599 | GNUNET_log (TIMEOUT_LOG, | 1604 | GNUNET_log (TIMEOUT_LOG, |
1600 | "Session %p was idle for %llu ms, disconnecting\n", | 1605 | "Session %p was idle for %s, disconnecting\n", |
1601 | s, (unsigned long long) CLIENT_SESSION_TIMEOUT.rel_value); | 1606 | s, |
1607 | GNUNET_STRINGS_relative_time_to_string (CLIENT_SESSION_TIMEOUT, | ||
1608 | GNUNET_YES)); | ||
1602 | 1609 | ||
1603 | /* call session destroy function */ | 1610 | /* call session destroy function */ |
1604 | GNUNET_assert (GNUNET_OK == client_disconnect (s)); | 1611 | GNUNET_assert (GNUNET_OK == client_disconnect (s)); |
@@ -1620,8 +1627,10 @@ client_start_session_timeout (struct Session *s) | |||
1620 | &client_session_timeout, | 1627 | &client_session_timeout, |
1621 | s); | 1628 | s); |
1622 | GNUNET_log (TIMEOUT_LOG, | 1629 | GNUNET_log (TIMEOUT_LOG, |
1623 | "Timeout for session %p set to %llu ms\n", | 1630 | "Timeout for session %p set to %s\n", |
1624 | s, (unsigned long long) CLIENT_SESSION_TIMEOUT.rel_value); | 1631 | s, |
1632 | GNUNET_STRINGS_relative_time_to_string (CLIENT_SESSION_TIMEOUT, | ||
1633 | GNUNET_YES)); | ||
1625 | } | 1634 | } |
1626 | 1635 | ||
1627 | 1636 | ||
@@ -1642,8 +1651,10 @@ client_reschedule_session_timeout (struct Session *s) | |||
1642 | &client_session_timeout, | 1651 | &client_session_timeout, |
1643 | s); | 1652 | s); |
1644 | GNUNET_log (TIMEOUT_LOG, | 1653 | GNUNET_log (TIMEOUT_LOG, |
1645 | "Timeout rescheduled for session %p set to %llu ms\n", | 1654 | "Timeout rescheduled for session %p set to %s\n", |
1646 | s, (unsigned long long) CLIENT_SESSION_TIMEOUT.rel_value); | 1655 | s, |
1656 | GNUNET_STRINGS_relative_time_to_string (CLIENT_SESSION_TIMEOUT, | ||
1657 | GNUNET_YES)); | ||
1647 | } | 1658 | } |
1648 | 1659 | ||
1649 | 1660 | ||
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 19833521a..17e39360c 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2002-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -876,29 +876,42 @@ server_disconnect (struct Session *s) | |||
876 | return GNUNET_OK; | 876 | return GNUNET_OK; |
877 | } | 877 | } |
878 | 878 | ||
879 | |||
880 | |||
881 | /** | ||
882 | * Tell MHD that the connection should timeout after #to seconds. | ||
883 | * | ||
884 | * @param plugin our plugin | ||
885 | * @param s session for which the timeout changes | ||
886 | * @param to timeout in seconds | ||
887 | */ | ||
879 | static void | 888 | static void |
880 | server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin, struct Session *s, int to) | 889 | server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin, |
890 | struct Session *s, | ||
891 | unsigned int to) | ||
881 | { | 892 | { |
882 | #if MHD_VERSION >= 0x00090E00 | 893 | #if MHD_VERSION >= 0x00090E00 |
883 | /* Setting timeouts for other connections */ | 894 | /* Setting timeouts for other connections */ |
884 | if (s->server_recv != NULL) | 895 | if (NULL != s->server_recv) |
885 | { | 896 | { |
886 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 897 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
887 | "Setting timeout for %p to %u sec.\n", s->server_recv, to); | 898 | "Setting timeout for %p to %u sec.\n", |
888 | MHD_set_connection_option (s->server_recv->mhd_conn, | 899 | s->server_recv, to); |
889 | MHD_CONNECTION_OPTION_TIMEOUT, | 900 | MHD_set_connection_option (s->server_recv->mhd_conn, |
890 | to); | 901 | MHD_CONNECTION_OPTION_TIMEOUT, |
891 | server_reschedule (plugin, s->server_recv->mhd_daemon, GNUNET_NO); | 902 | to); |
892 | } | 903 | server_reschedule (plugin, s->server_recv->mhd_daemon, GNUNET_NO); |
893 | if (s->server_send != NULL) | 904 | } |
894 | { | 905 | if (NULL != s->server_send) |
895 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 906 | { |
896 | "Setting timeout for %p to %u sec.\n", s->server_send, to); | 907 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
897 | MHD_set_connection_option (s->server_send->mhd_conn, | 908 | "Setting timeout for %p to %u sec.\n", |
898 | MHD_CONNECTION_OPTION_TIMEOUT, | 909 | s->server_send, to); |
899 | to); | 910 | MHD_set_connection_option (s->server_send->mhd_conn, |
900 | server_reschedule (plugin, s->server_send->mhd_daemon, GNUNET_NO); | 911 | MHD_CONNECTION_OPTION_TIMEOUT, |
901 | } | 912 | to); |
913 | server_reschedule (plugin, s->server_send->mhd_daemon, GNUNET_NO); | ||
914 | } | ||
902 | #endif | 915 | #endif |
903 | } | 916 | } |
904 | 917 | ||
@@ -1034,14 +1047,12 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin, | |||
1034 | struct ServerConnection *sc = NULL; | 1047 | struct ServerConnection *sc = NULL; |
1035 | const union MHD_ConnectionInfo *conn_info; | 1048 | const union MHD_ConnectionInfo *conn_info; |
1036 | struct GNUNET_ATS_Information ats; | 1049 | struct GNUNET_ATS_Information ats; |
1037 | |||
1038 | struct HttpAddress *addr; | 1050 | struct HttpAddress *addr; |
1039 | size_t addr_len; | 1051 | size_t addr_len; |
1040 | |||
1041 | struct GNUNET_PeerIdentity target; | 1052 | struct GNUNET_PeerIdentity target; |
1042 | uint32_t tag = 0; | 1053 | uint32_t tag = 0; |
1043 | int direction = GNUNET_SYSERR; | 1054 | int direction = GNUNET_SYSERR; |
1044 | int to; | 1055 | unsigned int to; |
1045 | 1056 | ||
1046 | conn_info = MHD_get_connection_info (mhd_connection, | 1057 | conn_info = MHD_get_connection_info (mhd_connection, |
1047 | MHD_CONNECTION_INFO_CLIENT_ADDRESS); | 1058 | MHD_CONNECTION_INFO_CLIENT_ADDRESS); |
@@ -1169,8 +1180,9 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin, | |||
1169 | #if MHD_VERSION >= 0x00090E00 | 1180 | #if MHD_VERSION >= 0x00090E00 |
1170 | if ((NULL == s->server_recv) || (NULL == s->server_send)) | 1181 | if ((NULL == s->server_recv) || (NULL == s->server_send)) |
1171 | { | 1182 | { |
1172 | to = (HTTP_SERVER_NOT_VALIDATED_TIMEOUT.rel_value / 1000); | 1183 | to = (HTTP_SERVER_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL / 1000LL); |
1173 | MHD_set_connection_option (mhd_connection, MHD_CONNECTION_OPTION_TIMEOUT, to); | 1184 | MHD_set_connection_option (mhd_connection, |
1185 | MHD_CONNECTION_OPTION_TIMEOUT, to); | ||
1174 | server_reschedule (plugin, sc->mhd_daemon, GNUNET_NO); | 1186 | server_reschedule (plugin, sc->mhd_daemon, GNUNET_NO); |
1175 | } | 1187 | } |
1176 | else | 1188 | else |
@@ -1178,7 +1190,7 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin, | |||
1178 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1190 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
1179 | "Session %p for peer `%s' fully connected\n", | 1191 | "Session %p for peer `%s' fully connected\n", |
1180 | s, GNUNET_i2s (&target)); | 1192 | s, GNUNET_i2s (&target)); |
1181 | to = (SERVER_SESSION_TIMEOUT.rel_value / 1000); | 1193 | to = (SERVER_SESSION_TIMEOUT.rel_value_us / 1000LL / 1000LL); |
1182 | server_mhd_connection_timeout (plugin, s, to); | 1194 | server_mhd_connection_timeout (plugin, s, to); |
1183 | } | 1195 | } |
1184 | 1196 | ||
@@ -1325,13 +1337,14 @@ server_receive_mst_cb (void *cls, void *client, | |||
1325 | 1337 | ||
1326 | s->session_passed = GNUNET_YES; | 1338 | s->session_passed = GNUNET_YES; |
1327 | s->next_receive = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay); | 1339 | s->next_receive = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay); |
1328 | if (delay.rel_value > 0) | 1340 | if (delay.rel_value_us > 0) |
1329 | { | 1341 | { |
1330 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1342 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
1331 | "Peer `%s' address `%s' next read delayed for %llu ms\n", | 1343 | "Peer `%s' address `%s' next read delayed for %s\n", |
1332 | GNUNET_i2s (&s->target), | 1344 | GNUNET_i2s (&s->target), |
1333 | http_common_plugin_address_to_string (NULL, p->protocol, s->addr, s->addrlen), | 1345 | http_common_plugin_address_to_string (NULL, p->protocol, s->addr, s->addrlen), |
1334 | delay); | 1346 | GNUNET_STRINGS_relative_time_to_string (delay, |
1347 | GNUNET_YES)); | ||
1335 | } | 1348 | } |
1336 | server_reschedule_session_timeout (s); | 1349 | server_reschedule_session_timeout (s); |
1337 | return GNUNET_OK; | 1350 | return GNUNET_OK; |
@@ -1477,7 +1490,7 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection, | |||
1477 | *upload_data_size); | 1490 | *upload_data_size); |
1478 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); | 1491 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); |
1479 | 1492 | ||
1480 | if ((s->next_receive.abs_value <= now.abs_value)) | 1493 | if ((s->next_receive.abs_value_us <= now.abs_value_us)) |
1481 | { | 1494 | { |
1482 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1495 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
1483 | "PUT with %u bytes forwarded to MST\n", | 1496 | "PUT with %u bytes forwarded to MST\n", |
@@ -1488,16 +1501,17 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection, | |||
1488 | } | 1501 | } |
1489 | GNUNET_SERVER_mst_receive (s->msg_tk, s, upload_data, | 1502 | GNUNET_SERVER_mst_receive (s->msg_tk, s, upload_data, |
1490 | *upload_data_size, GNUNET_NO, GNUNET_NO); | 1503 | *upload_data_size, GNUNET_NO, GNUNET_NO); |
1491 | #if MHD_VERSION >= 0x00090E00 | 1504 | server_mhd_connection_timeout (plugin, s, |
1492 | server_mhd_connection_timeout (plugin, s, GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value / 1000); | 1505 | GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value_us / 1000LL / 1000LL); |
1493 | #endif | ||
1494 | (*upload_data_size) = 0; | 1506 | (*upload_data_size) = 0; |
1495 | } | 1507 | } |
1496 | else | 1508 | else |
1497 | { | 1509 | { |
1498 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1510 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1499 | "Session %p / Connection %p: no inbound bandwidth available! Next read was delayed by %llu ms\n", | 1511 | "Session %p / Connection %p: no inbound bandwidth available! Next read was delayed by %s\n", |
1500 | s, sc, now.abs_value - s->next_receive.abs_value); | 1512 | s, sc, |
1513 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (s->next_receive), | ||
1514 | GNUNET_YES)); | ||
1501 | } | 1515 | } |
1502 | return MHD_YES; | 1516 | return MHD_YES; |
1503 | } | 1517 | } |
@@ -1753,12 +1767,12 @@ server_schedule (struct HTTP_Server_Plugin *plugin, | |||
1753 | { | 1767 | { |
1754 | 1768 | ||
1755 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1769 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
1756 | "SELECT Timeout changed from %llu to %llu\n", | 1770 | "SELECT Timeout changed from %llu to %llu (ms)\n", |
1757 | last_timeout, timeout); | 1771 | last_timeout, timeout); |
1758 | last_timeout = timeout; | 1772 | last_timeout = timeout; |
1759 | } | 1773 | } |
1760 | if (timeout <= GNUNET_TIME_UNIT_SECONDS.rel_value) | 1774 | if (timeout <= GNUNET_TIME_UNIT_SECONDS.rel_value_us / 1000LL) |
1761 | tv.rel_value = (uint64_t) timeout; | 1775 | tv.rel_value_us = (uint64_t) timeout * 1000LL; |
1762 | else | 1776 | else |
1763 | tv = GNUNET_TIME_UNIT_SECONDS; | 1777 | tv = GNUNET_TIME_UNIT_SECONDS; |
1764 | } | 1778 | } |
@@ -2007,12 +2021,12 @@ server_start (struct HTTP_Server_Plugin *plugin) | |||
2007 | 2021 | ||
2008 | 2022 | ||
2009 | #if MHD_VERSION >= 0x00090E00 | 2023 | #if MHD_VERSION >= 0x00090E00 |
2010 | timeout = HTTP_SERVER_NOT_VALIDATED_TIMEOUT.rel_value / 1000; | 2024 | timeout = HTTP_SERVER_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL / 1000LL; |
2011 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2025 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
2012 | "MHD can set timeout per connection! Default time out %u sec.\n", | 2026 | "MHD can set timeout per connection! Default time out %u sec.\n", |
2013 | timeout); | 2027 | timeout); |
2014 | #else | 2028 | #else |
2015 | timeout = SERVER_SESSION_TIMEOUT.rel_value / 1000; | 2029 | timeout = SERVER_SESSION_TIMEOUT.rel_value_us / 1000LL / 1000LL; |
2016 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, plugin->name, | 2030 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, plugin->name, |
2017 | "MHD cannot set timeout per connection! Default time out %u sec.\n", | 2031 | "MHD cannot set timeout per connection! Default time out %u sec.\n", |
2018 | timeout); | 2032 | timeout); |
@@ -2870,8 +2884,10 @@ server_session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
2870 | 2884 | ||
2871 | s->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 2885 | s->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
2872 | GNUNET_log (TIMEOUT_LOG, | 2886 | GNUNET_log (TIMEOUT_LOG, |
2873 | "Session %p was idle for %llu ms, disconnecting\n", | 2887 | "Session %p was idle for %s, disconnecting\n", |
2874 | s, (unsigned long long) SERVER_SESSION_TIMEOUT.rel_value); | 2888 | s, |
2889 | GNUNET_STRINGS_relative_time_to_string (SERVER_SESSION_TIMEOUT, | ||
2890 | GNUNET_YES)); | ||
2875 | 2891 | ||
2876 | /* call session destroy function */ | 2892 | /* call session destroy function */ |
2877 | GNUNET_assert (GNUNET_OK == server_disconnect (s)); | 2893 | GNUNET_assert (GNUNET_OK == server_disconnect (s)); |
@@ -2892,8 +2908,10 @@ server_start_session_timeout (struct Session *s) | |||
2892 | &server_session_timeout, | 2908 | &server_session_timeout, |
2893 | s); | 2909 | s); |
2894 | GNUNET_log (TIMEOUT_LOG, | 2910 | GNUNET_log (TIMEOUT_LOG, |
2895 | "Timeout for session %p set to %llu ms\n", | 2911 | "Timeout for session %p set to %s\n", |
2896 | s, (unsigned long long) SERVER_SESSION_TIMEOUT.rel_value); | 2912 | s, |
2913 | GNUNET_STRINGS_relative_time_to_string (SERVER_SESSION_TIMEOUT, | ||
2914 | GNUNET_YES)); | ||
2897 | } | 2915 | } |
2898 | 2916 | ||
2899 | 2917 | ||
@@ -2913,8 +2931,10 @@ server_reschedule_session_timeout (struct Session *s) | |||
2913 | &server_session_timeout, | 2931 | &server_session_timeout, |
2914 | s); | 2932 | s); |
2915 | GNUNET_log (TIMEOUT_LOG, | 2933 | GNUNET_log (TIMEOUT_LOG, |
2916 | "Timeout rescheduled for session %p set to %llu ms\n", | 2934 | "Timeout rescheduled for session %p set to %s\n", |
2917 | s, (unsigned long long) SERVER_SESSION_TIMEOUT.rel_value); | 2935 | s, |
2936 | GNUNET_STRINGS_relative_time_to_string (SERVER_SESSION_TIMEOUT, | ||
2937 | GNUNET_YES)); | ||
2918 | } | 2938 | } |
2919 | 2939 | ||
2920 | 2940 | ||
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index dc0beb73f..b1c4cab2b 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2002--2012 Christian Grothoff (and other contributing authors) | 3 | (C) 2002--2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -897,7 +897,7 @@ do_transmit (void *cls, size_t size, void *buf) | |||
897 | ret = 0; | 897 | ret = 0; |
898 | now = GNUNET_TIME_absolute_get (); | 898 | now = GNUNET_TIME_absolute_get (); |
899 | while ((NULL != (pos = session->pending_messages_head)) && | 899 | while ((NULL != (pos = session->pending_messages_head)) && |
900 | (pos->timeout.abs_value <= now.abs_value)) | 900 | (pos->timeout.abs_value_us <= now.abs_value_us)) |
901 | { | 901 | { |
902 | GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, | 902 | GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, |
903 | session->pending_messages_tail, pos); | 903 | session->pending_messages_tail, pos); |
@@ -2269,16 +2269,16 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client, | |||
2269 | 2269 | ||
2270 | reschedule_session_timeout (session); | 2270 | reschedule_session_timeout (session); |
2271 | 2271 | ||
2272 | if (delay.rel_value == 0) | 2272 | if (0 == delay.rel_value_us) |
2273 | { | 2273 | { |
2274 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 2274 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
2275 | } | 2275 | } |
2276 | else | 2276 | else |
2277 | { | 2277 | { |
2278 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2278 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2279 | "Throttling receiving from `%s' for %llu ms\n", | 2279 | "Throttling receiving from `%s' for %s\n", |
2280 | GNUNET_i2s (&session->target), | 2280 | GNUNET_i2s (&session->target), |
2281 | (unsigned long long) delay.rel_value); | 2281 | GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); |
2282 | GNUNET_SERVER_disable_receive_done_warning (client); | 2282 | GNUNET_SERVER_disable_receive_done_warning (client); |
2283 | session->receive_delay_task = | 2283 | session->receive_delay_task = |
2284 | GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session); | 2284 | GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session); |
@@ -2426,8 +2426,10 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2426 | 2426 | ||
2427 | s->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 2427 | s->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
2428 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2428 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2429 | "Session %p was idle for %llu ms, disconnecting\n", | 2429 | "Session %p was idle for %s, disconnecting\n", |
2430 | s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); | 2430 | s, |
2431 | GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | ||
2432 | GNUNET_YES)); | ||
2431 | /* call session destroy function */ | 2433 | /* call session destroy function */ |
2432 | disconnect_session(s); | 2434 | disconnect_session(s); |
2433 | } | 2435 | } |
@@ -2445,8 +2447,10 @@ start_session_timeout (struct Session *s) | |||
2445 | &session_timeout, | 2447 | &session_timeout, |
2446 | s); | 2448 | s); |
2447 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2449 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2448 | "Timeout for session %p set to %llu ms\n", | 2450 | "Timeout for session %p set to %s\n", |
2449 | s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); | 2451 | s, |
2452 | GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | ||
2453 | GNUNET_YES)); | ||
2450 | } | 2454 | } |
2451 | 2455 | ||
2452 | 2456 | ||
@@ -2464,8 +2468,10 @@ reschedule_session_timeout (struct Session *s) | |||
2464 | &session_timeout, | 2468 | &session_timeout, |
2465 | s); | 2469 | s); |
2466 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2470 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2467 | "Timeout rescheduled for session %p set to %llu ms\n", | 2471 | "Timeout rescheduled for session %p set to %s\n", |
2468 | s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); | 2472 | s, |
2473 | GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | ||
2474 | GNUNET_YES)); | ||
2469 | } | 2475 | } |
2470 | 2476 | ||
2471 | 2477 | ||
@@ -2483,7 +2489,7 @@ stop_session_timeout (struct Session *s) | |||
2483 | s->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 2489 | s->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
2484 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2490 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2485 | "Timeout stopped for session %p canceled\n", | 2491 | "Timeout stopped for session %p canceled\n", |
2486 | s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); | 2492 | s); |
2487 | } | 2493 | } |
2488 | } | 2494 | } |
2489 | 2495 | ||
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index be19c5de3..cb95a5a00 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2010, 2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2010-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -509,9 +509,9 @@ schedule_select (struct Plugin *plugin) | |||
509 | * - timeout minimum delay */ | 509 | * - timeout minimum delay */ |
510 | plugin->select_task = | 510 | plugin->select_task = |
511 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 511 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
512 | (0 == min_delay.rel_value) ? GNUNET_TIME_UNIT_FOREVER_REL : min_delay, | 512 | (0 == min_delay.rel_value_us) ? GNUNET_TIME_UNIT_FOREVER_REL : min_delay, |
513 | plugin->rs_v4, | 513 | plugin->rs_v4, |
514 | (0 == min_delay.rel_value) ? plugin->ws_v4 : NULL, | 514 | (0 == min_delay.rel_value_us) ? plugin->ws_v4 : NULL, |
515 | &udp_plugin_select, plugin); | 515 | &udp_plugin_select, plugin); |
516 | } | 516 | } |
517 | if ((GNUNET_YES == plugin->enable_ipv6) && (NULL != plugin->sockv6)) | 517 | if ((GNUNET_YES == plugin->enable_ipv6) && (NULL != plugin->sockv6)) |
@@ -525,9 +525,9 @@ schedule_select (struct Plugin *plugin) | |||
525 | GNUNET_SCHEDULER_cancel(plugin->select_task_v6); | 525 | GNUNET_SCHEDULER_cancel(plugin->select_task_v6); |
526 | plugin->select_task_v6 = | 526 | plugin->select_task_v6 = |
527 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 527 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
528 | (0 == min_delay.rel_value) ? GNUNET_TIME_UNIT_FOREVER_REL : min_delay, | 528 | (0 == min_delay.rel_value_us) ? GNUNET_TIME_UNIT_FOREVER_REL : min_delay, |
529 | plugin->rs_v6, | 529 | plugin->rs_v6, |
530 | (0 == min_delay.rel_value) ? plugin->ws_v6 : NULL, | 530 | (0 == min_delay.rel_value_us) ? plugin->ws_v6 : NULL, |
531 | &udp_plugin_select_v6, plugin); | 531 | &udp_plugin_select_v6, plugin); |
532 | } | 532 | } |
533 | } | 533 | } |
@@ -1328,8 +1328,10 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1328 | 1328 | ||
1329 | s->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 1329 | s->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
1330 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1330 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1331 | "Session %p was idle for %llu ms, disconnecting\n", | 1331 | "Session %p was idle for %s, disconnecting\n", |
1332 | s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); | 1332 | s, |
1333 | GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | ||
1334 | GNUNET_YES)); | ||
1333 | /* call session destroy function */ | 1335 | /* call session destroy function */ |
1334 | disconnect_session (s); | 1336 | disconnect_session (s); |
1335 | } | 1337 | } |
@@ -1347,8 +1349,10 @@ start_session_timeout (struct Session *s) | |||
1347 | &session_timeout, | 1349 | &session_timeout, |
1348 | s); | 1350 | s); |
1349 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1351 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1350 | "Timeout for session %p set to %llu ms\n", | 1352 | "Timeout for session %p set to %s\n", |
1351 | s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); | 1353 | s, |
1354 | GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | ||
1355 | GNUNET_YES)); | ||
1352 | } | 1356 | } |
1353 | 1357 | ||
1354 | 1358 | ||
@@ -1366,8 +1370,10 @@ reschedule_session_timeout (struct Session *s) | |||
1366 | &session_timeout, | 1370 | &session_timeout, |
1367 | s); | 1371 | s); |
1368 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1372 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1369 | "Timeout rescheduled for session %p set to %llu ms\n", | 1373 | "Timeout rescheduled for session %p set to %s\n", |
1370 | s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); | 1374 | s, |
1375 | GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | ||
1376 | GNUNET_YES)); | ||
1371 | } | 1377 | } |
1372 | 1378 | ||
1373 | 1379 | ||
@@ -1385,7 +1391,7 @@ stop_session_timeout (struct Session *s) | |||
1385 | s->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 1391 | s->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
1386 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1392 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1387 | "Timeout stopped for session %p canceled\n", | 1393 | "Timeout stopped for session %p canceled\n", |
1388 | s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value); | 1394 | s); |
1389 | } | 1395 | } |
1390 | } | 1396 | } |
1391 | 1397 | ||
@@ -2173,16 +2179,17 @@ ack_proc (void *cls, uint32_t id, const struct GNUNET_MessageHeader *msg) | |||
2173 | if (NULL == s) | 2179 | if (NULL == s) |
2174 | return; | 2180 | return; |
2175 | 2181 | ||
2176 | if (s->flow_delay_for_other_peer.rel_value <= UINT32_MAX) | 2182 | if (s->flow_delay_for_other_peer.rel_value_us <= UINT32_MAX) |
2177 | delay = s->flow_delay_for_other_peer.rel_value; | 2183 | delay = s->flow_delay_for_other_peer.rel_value_us; |
2178 | 2184 | ||
2179 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2185 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2180 | "Sending ACK to `%s' including delay of %u ms\n", | 2186 | "Sending ACK to `%s' including delay of %s\n", |
2181 | GNUNET_a2s (rc->src_addr, | 2187 | GNUNET_a2s (rc->src_addr, |
2182 | (rc->src_addr->sa_family == | 2188 | (rc->src_addr->sa_family == |
2183 | AF_INET) ? sizeof (struct sockaddr_in) : sizeof (struct | 2189 | AF_INET) ? sizeof (struct sockaddr_in) : sizeof (struct |
2184 | sockaddr_in6)), | 2190 | sockaddr_in6)), |
2185 | delay); | 2191 | GNUNET_STRINGS_relative_time_to_string (s->flow_delay_for_other_peer, |
2192 | GNUNET_YES)); | ||
2186 | udpw = GNUNET_malloc (sizeof (struct UDP_MessageWrapper) + msize); | 2193 | udpw = GNUNET_malloc (sizeof (struct UDP_MessageWrapper) + msize); |
2187 | udpw->msg_size = msize; | 2194 | udpw->msg_size = msize; |
2188 | udpw->payload_size = 0; | 2195 | udpw->payload_size = 0; |
@@ -2248,10 +2255,11 @@ read_process_ack (struct Plugin *plugin, | |||
2248 | return; | 2255 | return; |
2249 | } | 2256 | } |
2250 | 2257 | ||
2251 | flow_delay.rel_value = (uint64_t) ntohl (udp_ack->delay); | 2258 | flow_delay.rel_value_us = (uint64_t) ntohl (udp_ack->delay); |
2252 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2259 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2253 | "We received a sending delay of %llu\n", | 2260 | "We received a sending delay of %s\n", |
2254 | flow_delay.rel_value); | 2261 | GNUNET_STRINGS_relative_time_to_string (flow_delay, |
2262 | GNUNET_YES)); | ||
2255 | s->flow_delay_from_other_peer = | 2263 | s->flow_delay_from_other_peer = |
2256 | GNUNET_TIME_relative_to_absolute (flow_delay); | 2264 | GNUNET_TIME_relative_to_absolute (flow_delay); |
2257 | 2265 | ||
@@ -2324,7 +2332,7 @@ read_process_fragment (struct Plugin *plugin, | |||
2324 | d_ctx->hnode = | 2332 | d_ctx->hnode = |
2325 | GNUNET_CONTAINER_heap_insert (plugin->defrag_ctxs, d_ctx, | 2333 | GNUNET_CONTAINER_heap_insert (plugin->defrag_ctxs, d_ctx, |
2326 | (GNUNET_CONTAINER_HeapCostType) | 2334 | (GNUNET_CONTAINER_HeapCostType) |
2327 | now.abs_value); | 2335 | now.abs_value_us); |
2328 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2336 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2329 | "Created new defragmentation context for %u-byte fragment from `%s'\n", | 2337 | "Created new defragmentation context for %u-byte fragment from `%s'\n", |
2330 | (unsigned int) ntohs (msg->size), | 2338 | (unsigned int) ntohs (msg->size), |
@@ -2343,7 +2351,7 @@ read_process_fragment (struct Plugin *plugin, | |||
2343 | /* keep this 'rc' from expiring */ | 2351 | /* keep this 'rc' from expiring */ |
2344 | GNUNET_CONTAINER_heap_update_cost (plugin->defrag_ctxs, d_ctx->hnode, | 2352 | GNUNET_CONTAINER_heap_update_cost (plugin->defrag_ctxs, d_ctx->hnode, |
2345 | (GNUNET_CONTAINER_HeapCostType) | 2353 | (GNUNET_CONTAINER_HeapCostType) |
2346 | now.abs_value); | 2354 | now.abs_value_us); |
2347 | } | 2355 | } |
2348 | if (GNUNET_CONTAINER_heap_get_size (plugin->defrag_ctxs) > | 2356 | if (GNUNET_CONTAINER_heap_get_size (plugin->defrag_ctxs) > |
2349 | UDP_MAX_SENDER_ADDRESSES_WITH_DEFRAG) | 2357 | UDP_MAX_SENDER_ADDRESSES_WITH_DEFRAG) |
@@ -2459,7 +2467,7 @@ remove_timeout_messages_and_select (struct UDP_MessageWrapper *head, | |||
2459 | { | 2467 | { |
2460 | /* Find messages with timeout */ | 2468 | /* Find messages with timeout */ |
2461 | remaining = GNUNET_TIME_absolute_get_remaining (udpw->timeout); | 2469 | remaining = GNUNET_TIME_absolute_get_remaining (udpw->timeout); |
2462 | if (GNUNET_TIME_UNIT_ZERO.rel_value == remaining.rel_value) | 2470 | if (GNUNET_TIME_UNIT_ZERO.rel_value_us == remaining.rel_value_us) |
2463 | { | 2471 | { |
2464 | /* Message timed out */ | 2472 | /* Message timed out */ |
2465 | switch (udpw->msg_type) { | 2473 | switch (udpw->msg_type) { |
@@ -2542,7 +2550,7 @@ remove_timeout_messages_and_select (struct UDP_MessageWrapper *head, | |||
2542 | { | 2550 | { |
2543 | /* Message did not time out, check flow delay */ | 2551 | /* Message did not time out, check flow delay */ |
2544 | remaining = GNUNET_TIME_absolute_get_remaining (udpw->session->flow_delay_from_other_peer); | 2552 | remaining = GNUNET_TIME_absolute_get_remaining (udpw->session->flow_delay_from_other_peer); |
2545 | if (GNUNET_TIME_UNIT_ZERO.rel_value == remaining.rel_value) | 2553 | if (GNUNET_TIME_UNIT_ZERO.rel_value_us == remaining.rel_value_us) |
2546 | { | 2554 | { |
2547 | /* this message is not delayed */ | 2555 | /* this message is not delayed */ |
2548 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2556 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -2554,8 +2562,10 @@ remove_timeout_messages_and_select (struct UDP_MessageWrapper *head, | |||
2554 | { | 2562 | { |
2555 | /* Message is delayed, try next */ | 2563 | /* Message is delayed, try next */ |
2556 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2564 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2557 | "Message for peer `%s' (%u bytes) is delayed for %llu \n", | 2565 | "Message for peer `%s' (%u bytes) is delayed for %s\n", |
2558 | GNUNET_i2s(&udpw->session->target), udpw->payload_size, remaining.rel_value); | 2566 | GNUNET_i2s(&udpw->session->target), udpw->payload_size, |
2567 | GNUNET_STRINGS_relative_time_to_string (remaining, | ||
2568 | GNUNET_YES)); | ||
2559 | udpw = udpw->next; | 2569 | udpw = udpw->next; |
2560 | } | 2570 | } |
2561 | } | 2571 | } |
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index 19a4d8e60..211408f18 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c | |||
@@ -1080,7 +1080,7 @@ unix_plugin_select_write (struct Plugin *plugin) | |||
1080 | 1080 | ||
1081 | while (NULL != (msgw = plugin->msg_tail)) | 1081 | while (NULL != (msgw = plugin->msg_tail)) |
1082 | { | 1082 | { |
1083 | if (GNUNET_TIME_absolute_get_remaining (msgw->timeout).rel_value > 0) | 1083 | if (GNUNET_TIME_absolute_get_remaining (msgw->timeout).rel_value_us > 0) |
1084 | break; /* Message is ready for sending */ | 1084 | break; /* Message is ready for sending */ |
1085 | /* Message has a timeout */ | 1085 | /* Message has a timeout */ |
1086 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1086 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index a376a2642..42ed771f4 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -692,7 +692,7 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
692 | 692 | ||
693 | session->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 693 | session->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
694 | timeout = GNUNET_TIME_absolute_get_remaining (session->timeout); | 694 | timeout = GNUNET_TIME_absolute_get_remaining (session->timeout); |
695 | if (0 == timeout.rel_value) | 695 | if (0 == timeout.rel_value_us) |
696 | { | 696 | { |
697 | free_session (session); | 697 | free_session (session); |
698 | return; | 698 | return; |
@@ -1003,7 +1003,7 @@ macendpoint_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1003 | 1003 | ||
1004 | endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 1004 | endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
1005 | timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout); | 1005 | timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout); |
1006 | if (0 == timeout.rel_value) | 1006 | if (0 == timeout.rel_value_us) |
1007 | { | 1007 | { |
1008 | free_macendpoint (endpoint); | 1008 | free_macendpoint (endpoint); |
1009 | return; | 1009 | return; |
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index 37960e204..0dfe27c64 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c | |||
@@ -129,8 +129,8 @@ end () | |||
129 | 129 | ||
130 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); | 130 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); |
131 | 131 | ||
132 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; | 132 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; |
133 | datarate = (total_bytes_sent * 1000) / delta; | 133 | datarate = (total_bytes_sent * 1000 * 1000) / delta; |
134 | 134 | ||
135 | FPRINTF (stderr, "Throughput was %llu b/s\n", datarate); | 135 | FPRINTF (stderr, "Throughput was %llu b/s\n", datarate); |
136 | 136 | ||
@@ -398,7 +398,7 @@ measure (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
398 | measure_task = GNUNET_SCHEDULER_NO_TASK; | 398 | measure_task = GNUNET_SCHEDULER_NO_TASK; |
399 | 399 | ||
400 | counter++; | 400 | counter++; |
401 | if ((DURATION.rel_value / 1000) < counter) | 401 | if ((DURATION.rel_value_us / 1000 / 1000LL) < counter) |
402 | { | 402 | { |
403 | FPRINTF (stderr, "%s", ".\n"); | 403 | FPRINTF (stderr, "%s", ".\n"); |
404 | GNUNET_SCHEDULER_add_now (&end, NULL); | 404 | GNUNET_SCHEDULER_add_now (&end, NULL); |
diff --git a/src/transport/test_transport_api_manipulation_cfg.c b/src/transport/test_transport_api_manipulation_cfg.c index b7321af85..c9bb5d08a 100644 --- a/src/transport/test_transport_api_manipulation_cfg.c +++ b/src/transport/test_transport_api_manipulation_cfg.c | |||
@@ -25,8 +25,8 @@ | |||
25 | * Peer 1 has inbound and outbound delay of 100ms | 25 | * Peer 1 has inbound and outbound delay of 100ms |
26 | * Peer 2 has no inbound and outbound delay | 26 | * Peer 2 has no inbound and outbound delay |
27 | * | 27 | * |
28 | * We send a request from P1 to P2 and expect delay of >= TEST_DELAY ms | 28 | * We send a request from P1 to P2 and expect delay of >= TEST_DELAY us |
29 | * Then we send response from P2 to P1 and expect delay of >= TEST_DELAY ms | 29 | * Then we send response from P2 to P1 and expect delay of >= TEST_DELAY us |
30 | */ | 30 | */ |
31 | #include "platform.h" | 31 | #include "platform.h" |
32 | #include "gnunet_transport_service.h" | 32 | #include "gnunet_transport_service.h" |
@@ -48,7 +48,10 @@ | |||
48 | 48 | ||
49 | #define TEST_RESPONSE_MESSAGE_TYPE 12346 | 49 | #define TEST_RESPONSE_MESSAGE_TYPE 12346 |
50 | 50 | ||
51 | #define TEST_DELAY 100 | 51 | /** |
52 | * Test delay, in microseconds. | ||
53 | */ | ||
54 | #define TEST_DELAY 100 * 1000LL | ||
52 | 55 | ||
53 | static char *test_source; | 56 | static char *test_source; |
54 | 57 | ||
@@ -304,16 +307,18 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
304 | case TEST_REQUEST_MESSAGE_TYPE: | 307 | case TEST_REQUEST_MESSAGE_TYPE: |
305 | duration = GNUNET_TIME_absolute_get_difference(start_request, | 308 | duration = GNUNET_TIME_absolute_get_difference(start_request, |
306 | GNUNET_TIME_absolute_get()); | 309 | GNUNET_TIME_absolute_get()); |
307 | if (duration.rel_value >= TEST_DELAY) | 310 | if (duration.rel_value_us >= TEST_DELAY) |
308 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 311 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
309 | "Request message was delayed for %llu ms\n", | 312 | "Request message was delayed for %s\n", |
310 | duration.rel_value); | 313 | GNUNET_STRINGS_relative_time_to_string (duration, |
314 | GNUNET_YES)); | ||
311 | else | 315 | else |
312 | { | 316 | { |
313 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 317 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
314 | "Request message was delayed for %llu ms, should be %u ms\n", | 318 | "Request message was delayed for unexpected duration %s\n", |
315 | duration.rel_value, TEST_DELAY); | 319 | GNUNET_STRINGS_relative_time_to_string (duration, |
316 | ok = 1; | 320 | GNUNET_YES)); |
321 | ok = 1; | ||
317 | } | 322 | } |
318 | 323 | ||
319 | /* Send response */ | 324 | /* Send response */ |
@@ -323,15 +328,18 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
323 | case TEST_RESPONSE_MESSAGE_TYPE: | 328 | case TEST_RESPONSE_MESSAGE_TYPE: |
324 | duration = GNUNET_TIME_absolute_get_difference(start_response, | 329 | duration = GNUNET_TIME_absolute_get_difference(start_response, |
325 | GNUNET_TIME_absolute_get()); | 330 | GNUNET_TIME_absolute_get()); |
326 | if (duration.rel_value >= TEST_DELAY) | 331 | if (duration.rel_value_us >= TEST_DELAY) |
327 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 332 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
328 | "Response message was delayed for %llu ms\n", duration); | 333 | "Response message was delayed for %s\n", |
334 | GNUNET_STRINGS_relative_time_to_string (duration, | ||
335 | GNUNET_YES)); | ||
329 | else | 336 | else |
330 | { | 337 | { |
331 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 338 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
332 | "Response message was delayed for %llu ms, should be %u ms\n", | 339 | "Response message was delayed for unexpected duration %s\n", |
333 | duration.rel_value, TEST_DELAY); | 340 | GNUNET_STRINGS_relative_time_to_string (duration, |
334 | ok = 1; | 341 | GNUNET_YES)); |
342 | ok = 1; | ||
335 | } | 343 | } |
336 | /* Done */ | 344 | /* Done */ |
337 | ok = 0; | 345 | ok = 0; |
diff --git a/src/transport/test_transport_api_manipulation_recv_tcp.c b/src/transport/test_transport_api_manipulation_recv_tcp.c index 83d1431dc..a91866be4 100644 --- a/src/transport/test_transport_api_manipulation_recv_tcp.c +++ b/src/transport/test_transport_api_manipulation_recv_tcp.c | |||
@@ -200,13 +200,14 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
200 | /* Received non-delayed message */ | 200 | /* Received non-delayed message */ |
201 | dur_normal = GNUNET_TIME_absolute_get_duration(start_normal); | 201 | dur_normal = GNUNET_TIME_absolute_get_duration(start_normal); |
202 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 202 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
203 | "Received non-delayed message %u after %llu\n", | 203 | "Received non-delayed message %u after %s\n", |
204 | messages_recv, | 204 | messages_recv, |
205 | (long long unsigned int) dur_normal.rel_value); | 205 | GNUNET_STRINGS_relative_time_to_string (dur_normal, |
206 | GNUNET_YES)); | ||
206 | 207 | ||
207 | struct GNUNET_ATS_Information ats[2]; | 208 | struct GNUNET_ATS_Information ats[2]; |
208 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); | 209 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); |
209 | ats[0].value = htonl (1000); | 210 | ats[0].value = htonl (1000 * 1000LL); |
210 | ats[1].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); | 211 | ats[1].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); |
211 | ats[1].value = htonl (10); | 212 | ats[1].value = htonl (10); |
212 | 213 | ||
@@ -218,16 +219,18 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
218 | /* Received manipulated message */ | 219 | /* Received manipulated message */ |
219 | dur_delayed = GNUNET_TIME_absolute_get_duration(start_delayed); | 220 | dur_delayed = GNUNET_TIME_absolute_get_duration(start_delayed); |
220 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 221 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
221 | "Received delayed message %u after %llu\n", | 222 | "Received delayed message %u after %s\n", |
222 | messages_recv, | 223 | messages_recv, |
223 | (long long unsigned int) dur_delayed.rel_value); | 224 | GNUNET_STRINGS_relative_time_to_string (dur_delayed, |
224 | if (dur_delayed.rel_value < 1000) | 225 | GNUNET_YES)); |
226 | if (dur_delayed.rel_value_us < 1000 * 1000LL) | ||
225 | { | 227 | { |
226 | GNUNET_break (0); | 228 | GNUNET_break (0); |
227 | ok += 1; | 229 | ok += 1; |
228 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 230 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
229 | "Delayed message was not delayed correctly: took only %llu\n", | 231 | "Delayed message was not delayed correctly: took only %s\n", |
230 | (long long unsigned int) dur_delayed.rel_value); | 232 | GNUNET_STRINGS_relative_time_to_string (dur_delayed, |
233 | GNUNET_YES)); | ||
231 | } | 234 | } |
232 | /* shutdown */ | 235 | /* shutdown */ |
233 | end (); | 236 | end (); |
diff --git a/src/transport/test_transport_api_manipulation_send_tcp.c b/src/transport/test_transport_api_manipulation_send_tcp.c index 5361e0aba..2b7fdc250 100644 --- a/src/transport/test_transport_api_manipulation_send_tcp.c +++ b/src/transport/test_transport_api_manipulation_send_tcp.c | |||
@@ -200,9 +200,10 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
200 | /* Received non-delayed message */ | 200 | /* Received non-delayed message */ |
201 | dur_normal = GNUNET_TIME_absolute_get_duration(start_normal); | 201 | dur_normal = GNUNET_TIME_absolute_get_duration(start_normal); |
202 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 202 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
203 | "Received non-delayed message %u after %llu\n", | 203 | "Received non-delayed message %u after %s\n", |
204 | messages_recv, | 204 | messages_recv, |
205 | (long long unsigned int) dur_normal.rel_value); | 205 | GNUNET_STRINGS_relative_time_to_string (dur_normal, |
206 | GNUNET_YES)); | ||
206 | send_task = GNUNET_SCHEDULER_add_now (&sendtask, NULL); | 207 | send_task = GNUNET_SCHEDULER_add_now (&sendtask, NULL); |
207 | } | 208 | } |
208 | if (1 == messages_recv) | 209 | if (1 == messages_recv) |
@@ -210,16 +211,18 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
210 | /* Received manipulated message */ | 211 | /* Received manipulated message */ |
211 | dur_delayed = GNUNET_TIME_absolute_get_duration(start_delayed); | 212 | dur_delayed = GNUNET_TIME_absolute_get_duration(start_delayed); |
212 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 213 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
213 | "Received delayed message %u after %llu\n", | 214 | "Received delayed message %u after %s\n", |
214 | messages_recv, | 215 | messages_recv, |
215 | (long long unsigned int) dur_delayed.rel_value); | 216 | GNUNET_STRINGS_relative_time_to_string (dur_delayed, |
216 | if (dur_delayed.rel_value < 1000) | 217 | GNUNET_YES)); |
218 | if (dur_delayed.rel_value_us < 1000 * 1000LL) | ||
217 | { | 219 | { |
218 | GNUNET_break (0); | 220 | GNUNET_break (0); |
219 | ok += 1; | 221 | ok += 1; |
220 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 222 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
221 | "Delayed message was not delayed correctly: took only %llu\n", | 223 | "Delayed message was not delayed correctly: took only %s\n", |
222 | (long long unsigned int) dur_delayed.rel_value); | 224 | GNUNET_STRINGS_relative_time_to_string (dur_delayed, |
225 | GNUNET_YES)); | ||
223 | } | 226 | } |
224 | 227 | ||
225 | /* shutdown */ | 228 | /* shutdown */ |
@@ -291,7 +294,7 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
291 | if (1 == messages_recv) | 294 | if (1 == messages_recv) |
292 | { | 295 | { |
293 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); | 296 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); |
294 | ats[0].value = htonl (1000); | 297 | ats[0].value = htonl (1000LL * 1000LL); |
295 | GNUNET_TRANSPORT_set_traffic_metric (p2->th, &p1->id, GNUNET_NO, GNUNET_YES, ats, 1); | 298 | GNUNET_TRANSPORT_set_traffic_metric (p2->th, &p1->id, GNUNET_NO, GNUNET_YES, ats, 1); |
296 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); | 299 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); |
297 | ats[0].value = htonl (10); | 300 | ats[0].value = htonl (10); |
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 2993a224d..d129350c2 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c | |||
@@ -123,11 +123,11 @@ end () | |||
123 | 123 | ||
124 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); | 124 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); |
125 | 125 | ||
126 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; | 126 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; |
127 | FPRINTF (stderr, "\nThroughput was %llu kb/s\n", | 127 | FPRINTF (stderr, "\nThroughput was %llu kb/s\n", |
128 | total_bytes * 1000 / 1024 / delta); | 128 | total_bytes * 1024 / delta); |
129 | GNUNET_asprintf (&value_name, "reliable_%s", test_plugin); | 129 | GNUNET_asprintf (&value_name, "reliable_%s", test_plugin); |
130 | GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta), | 130 | GAUGER ("TRANSPORT", value_name, (int) (total_bytes / 1024 / delta), |
131 | "kb/s"); | 131 | "kb/s"); |
132 | GNUNET_free (value_name); | 132 | GNUNET_free (value_name); |
133 | 133 | ||
diff --git a/src/transport/test_transport_api_timeout.c b/src/transport/test_transport_api_timeout.c index a3bef6b94..908374cb7 100644 --- a/src/transport/test_transport_api_timeout.c +++ b/src/transport/test_transport_api_timeout.c | |||
@@ -111,8 +111,10 @@ end () | |||
111 | { | 111 | { |
112 | ok = disconnects; | 112 | ok = disconnects; |
113 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 113 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
114 | "Fail! Had %u disconnects while waiting %llu seconds \n", | 114 | "Fail! Had %u disconnects while waiting %s\n", |
115 | disconnects, WAIT.rel_value); | 115 | disconnects, |
116 | GNUNET_STRINGS_relative_time_to_string (WAIT, | ||
117 | GNUNET_YES)); | ||
116 | } | 118 | } |
117 | 119 | ||
118 | GNUNET_TRANSPORT_TESTING_done (tth); | 120 | GNUNET_TRANSPORT_TESTING_done (tth); |
@@ -193,8 +195,8 @@ timer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
193 | GNUNET_TIME_relative_add (time_running, | 195 | GNUNET_TIME_relative_add (time_running, |
194 | GNUNET_TIME_relative_divide (WAIT, 10)); | 196 | GNUNET_TIME_relative_divide (WAIT, 10)); |
195 | 197 | ||
196 | if (time_running.rel_value == | 198 | if (time_running.rel_value_us == |
197 | GNUNET_TIME_relative_max (time_running, WAIT).rel_value) | 199 | GNUNET_TIME_relative_max (time_running, WAIT).rel_value_us) |
198 | { | 200 | { |
199 | FPRINTF (stderr, "%s", "100%%\n"); | 201 | FPRINTF (stderr, "%s", "100%%\n"); |
200 | shutdown_flag = GNUNET_YES; | 202 | shutdown_flag = GNUNET_YES; |
@@ -221,7 +223,10 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) | |||
221 | 223 | ||
222 | shutdown_flag = GNUNET_NO; | 224 | shutdown_flag = GNUNET_NO; |
223 | 225 | ||
224 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Waiting for %llu seconds\n", (WAIT.rel_value) / 1000); | 226 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
227 | "Waiting for %s\n", | ||
228 | GNUNET_STRINGS_relative_time_to_string (WAIT, | ||
229 | GNUNET_YES)); | ||
225 | 230 | ||
226 | if (die_task != GNUNET_SCHEDULER_NO_TASK) | 231 | if (die_task != GNUNET_SCHEDULER_NO_TASK) |
227 | GNUNET_SCHEDULER_cancel (die_task); | 232 | GNUNET_SCHEDULER_cancel (die_task); |
diff --git a/src/transport/test_transport_api_unreliability.c b/src/transport/test_transport_api_unreliability.c index afc26cef7..9bae154de 100644 --- a/src/transport/test_transport_api_unreliability.c +++ b/src/transport/test_transport_api_unreliability.c | |||
@@ -131,11 +131,11 @@ end () | |||
131 | 131 | ||
132 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); | 132 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); |
133 | 133 | ||
134 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; | 134 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; |
135 | FPRINTF (stderr, "\nThroughput was %llu kb/s\n", | 135 | FPRINTF (stderr, "\nThroughput was %llu kb/s\n", |
136 | total_bytes * 1000 / 1024 / delta); | 136 | total_bytes * 1024 / delta); |
137 | GNUNET_asprintf (&value_name, "unreliable_%s", test_plugin); | 137 | GNUNET_asprintf (&value_name, "unreliable_%s", test_plugin); |
138 | GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta), | 138 | GAUGER ("TRANSPORT", value_name, (int) (total_bytes / 1024 / delta), |
139 | "kb/s"); | 139 | "kb/s"); |
140 | GNUNET_free (value_name); | 140 | GNUNET_free (value_name); |
141 | 141 | ||
diff --git a/src/transport/test_transport_api_unreliability_constant.c b/src/transport/test_transport_api_unreliability_constant.c index e5c244081..5217638c5 100644 --- a/src/transport/test_transport_api_unreliability_constant.c +++ b/src/transport/test_transport_api_unreliability_constant.c | |||
@@ -122,16 +122,15 @@ static void | |||
122 | end () | 122 | end () |
123 | { | 123 | { |
124 | unsigned long long delta; | 124 | unsigned long long delta; |
125 | |||
126 | char *value_name; | 125 | char *value_name; |
127 | 126 | ||
128 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); | 127 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n"); |
129 | 128 | ||
130 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; | 129 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; |
131 | FPRINTF (stderr, "\nThroughput was %llu kb/s\n", | 130 | FPRINTF (stderr, "\nThroughput was %llu kb/s\n", |
132 | total_bytes * 1000 / 1024 / delta); | 131 | total_bytes / 1024 / delta); |
133 | GNUNET_asprintf (&value_name, "unreliable_%s", test_plugin); | 132 | GNUNET_asprintf (&value_name, "unreliable_%s", test_plugin); |
134 | GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta), | 133 | GAUGER ("TRANSPORT", value_name, (int) (total_bytes / 1024 / delta), |
135 | "kb/s"); | 134 | "kb/s"); |
136 | GNUNET_free (value_name); | 135 | GNUNET_free (value_name); |
137 | 136 | ||
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index f92895c52..f83b6c098 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2009-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -744,7 +744,7 @@ transport_notify_ready (void *cls, size_t size, void *buf) | |||
744 | if (th->notify_size + sizeof (struct OutboundMessage) > size) | 744 | if (th->notify_size + sizeof (struct OutboundMessage) > size) |
745 | break; /* does not fit */ | 745 | break; /* does not fit */ |
746 | if (GNUNET_BANDWIDTH_tracker_get_delay | 746 | if (GNUNET_BANDWIDTH_tracker_get_delay |
747 | (&n->out_tracker, th->notify_size).rel_value > 0) | 747 | (&n->out_tracker, th->notify_size).rel_value_us > 0) |
748 | break; /* too early */ | 748 | break; /* too early */ |
749 | GNUNET_assert (n == GNUNET_CONTAINER_heap_remove_root (h->ready_heap)); | 749 | GNUNET_assert (n == GNUNET_CONTAINER_heap_remove_root (h->ready_heap)); |
750 | n->hn = NULL; | 750 | n->hn = NULL; |
@@ -801,7 +801,7 @@ schedule_transmission_task (void *cls, | |||
801 | GNUNET_assert (NULL != h->client); | 801 | GNUNET_assert (NULL != h->client); |
802 | /* destroy all requests that have timed out */ | 802 | /* destroy all requests that have timed out */ |
803 | while ((NULL != (n = GNUNET_CONTAINER_heap_peek (h->ready_heap))) && | 803 | while ((NULL != (n = GNUNET_CONTAINER_heap_peek (h->ready_heap))) && |
804 | (GNUNET_TIME_absolute_get_remaining (n->th->timeout).rel_value == 0)) | 804 | (0 == GNUNET_TIME_absolute_get_remaining (n->th->timeout).rel_value_us)) |
805 | { | 805 | { |
806 | /* notify client that the request could not be satisfied within | 806 | /* notify client that the request could not be satisfied within |
807 | * the given time constraints */ | 807 | * the given time constraints */ |
@@ -868,8 +868,8 @@ schedule_transmission (struct GNUNET_TRANSPORT_Handle *h) | |||
868 | else | 868 | else |
869 | return; /* no work to be done */ | 869 | return; /* no work to be done */ |
870 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 870 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
871 | "Scheduling next transmission to service in %llu ms\n", | 871 | "Scheduling next transmission to service in %s\n", |
872 | (unsigned long long) delay.rel_value); | 872 | GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); |
873 | h->quota_task = | 873 | h->quota_task = |
874 | GNUNET_SCHEDULER_add_delayed (delay, &schedule_transmission_task, h); | 874 | GNUNET_SCHEDULER_add_delayed (delay, &schedule_transmission_task, h); |
875 | } | 875 | } |
@@ -1007,8 +1007,8 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h) | |||
1007 | GNUNET_free (th); | 1007 | GNUNET_free (th); |
1008 | } | 1008 | } |
1009 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1009 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1010 | "Scheduling task to reconnect to transport service in %llu ms.\n", | 1010 | "Scheduling task to reconnect to transport service in %s.\n", |
1011 | h->reconnect_delay.rel_value); | 1011 | GNUNET_STRINGS_relative_time_to_string(h->reconnect_delay, GNUNET_YES)); |
1012 | h->reconnect_task = | 1012 | h->reconnect_task = |
1013 | GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h); | 1013 | GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h); |
1014 | h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay); | 1014 | h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay); |
@@ -1564,12 +1564,13 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle, | |||
1564 | /* calculate when our transmission should be ready */ | 1564 | /* calculate when our transmission should be ready */ |
1565 | delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size + n->traffic_overhead); | 1565 | delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size + n->traffic_overhead); |
1566 | n->traffic_overhead = 0; | 1566 | n->traffic_overhead = 0; |
1567 | if (delay.rel_value > timeout.rel_value) | 1567 | if (delay.rel_value_us > timeout.rel_value_us) |
1568 | delay.rel_value = 0; /* notify immediately (with failure) */ | 1568 | delay.rel_value_us = 0; /* notify immediately (with failure) */ |
1569 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1569 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1570 | "Bandwidth tracker allows next transmission to peer %s in %llu ms\n", | 1570 | "Bandwidth tracker allows next transmission to peer %s in %s\n", |
1571 | GNUNET_i2s (target), (unsigned long long) delay.rel_value); | 1571 | GNUNET_i2s (target), |
1572 | n->hn = GNUNET_CONTAINER_heap_insert (handle->ready_heap, n, delay.rel_value); | 1572 | GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); |
1573 | n->hn = GNUNET_CONTAINER_heap_insert (handle->ready_heap, n, delay.rel_value_us); | ||
1573 | schedule_transmission (handle); | 1574 | schedule_transmission (handle); |
1574 | return th; | 1575 | return th; |
1575 | } | 1576 | } |
diff --git a/src/util/bandwidth.c b/src/util/bandwidth.c index 60cb50529..5caaec03c 100644 --- a/src/util/bandwidth.c +++ b/src/util/bandwidth.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2010 Christian Grothoff (and other contributing authors) | 3 | (C) 2010, 2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -83,9 +83,9 @@ GNUNET_BANDWIDTH_value_get_available_until (struct GNUNET_BANDWIDTH_Value32NBO | |||
83 | b = ntohl (bps.value__); | 83 | b = ntohl (bps.value__); |
84 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 84 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
85 | "Bandwidth has %llu bytes available until deadline in %s\n", | 85 | "Bandwidth has %llu bytes available until deadline in %s\n", |
86 | (unsigned long long) ((b * deadline.rel_value + 500LL) / 1000LL), | 86 | (unsigned long long) ((b * deadline.rel_value_us + 500000LL) / 1000000LL), |
87 | GNUNET_STRINGS_relative_time_to_string (deadline, GNUNET_YES)); | 87 | GNUNET_STRINGS_relative_time_to_string (deadline, GNUNET_YES)); |
88 | return (b * deadline.rel_value + 500LL) / 1000LL; | 88 | return (b * deadline.rel_value_us + 500000LL) / 1000000LL; |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
@@ -105,16 +105,17 @@ GNUNET_BANDWIDTH_value_get_delay_for (struct GNUNET_BANDWIDTH_Value32NBO bps, | |||
105 | struct GNUNET_TIME_Relative ret; | 105 | struct GNUNET_TIME_Relative ret; |
106 | 106 | ||
107 | b = ntohl (bps.value__); | 107 | b = ntohl (bps.value__); |
108 | if (b == 0) | 108 | if (0 == b) |
109 | { | 109 | { |
110 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 110 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
111 | "Bandwidth suggests delay of infinity (zero bandwidth)\n"); | 111 | "Bandwidth suggests delay of infinity (zero bandwidth)\n"); |
112 | return GNUNET_TIME_UNIT_FOREVER_REL; | 112 | return GNUNET_TIME_UNIT_FOREVER_REL; |
113 | } | 113 | } |
114 | ret.rel_value = size * 1000LL / b; | 114 | ret.rel_value_us = size * 1000LL * 1000LL / b; |
115 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 115 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
116 | "Bandwidth suggests delay of %llu ms for %llu bytes of traffic\n", | 116 | "Bandwidth suggests delay of %s for %llu bytes of traffic\n", |
117 | (unsigned long long) ret.rel_value, (unsigned long long) size); | 117 | GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES), |
118 | (unsigned long long) size); | ||
118 | return ret; | 119 | return ret; |
119 | } | 120 | } |
120 | 121 | ||
@@ -158,16 +159,17 @@ static void | |||
158 | update_tracker (struct GNUNET_BANDWIDTH_Tracker *av) | 159 | update_tracker (struct GNUNET_BANDWIDTH_Tracker *av) |
159 | { | 160 | { |
160 | struct GNUNET_TIME_Absolute now; | 161 | struct GNUNET_TIME_Absolute now; |
162 | struct GNUNET_TIME_Relative delta; | ||
161 | uint64_t delta_time; | 163 | uint64_t delta_time; |
162 | uint64_t delta_avail; | 164 | uint64_t delta_avail; |
163 | uint64_t left_bytes; | 165 | uint64_t left_bytes; |
164 | uint64_t max_carry; | 166 | uint64_t max_carry; |
165 | 167 | ||
166 | now = GNUNET_TIME_absolute_get (); | 168 | now = GNUNET_TIME_absolute_get (); |
167 | delta_time = now.abs_value - av->last_update__.abs_value; | 169 | delta_time = now.abs_value_us - av->last_update__.abs_value_us; |
168 | delta_avail = | 170 | delta_avail = |
169 | (delta_time * ((unsigned long long) av->available_bytes_per_s__) + | 171 | (delta_time * ((unsigned long long) av->available_bytes_per_s__) + |
170 | 500LL) / 1000LL; | 172 | 500000LL) / 1000000LL; |
171 | av->consumption_since_last_update__ -= delta_avail; | 173 | av->consumption_since_last_update__ -= delta_avail; |
172 | av->last_update__ = now; | 174 | av->last_update__ = now; |
173 | if (av->consumption_since_last_update__ < 0) | 175 | if (av->consumption_since_last_update__ < 0) |
@@ -181,10 +183,11 @@ update_tracker (struct GNUNET_BANDWIDTH_Tracker *av) | |||
181 | else | 183 | else |
182 | av->consumption_since_last_update__ = -max_carry; | 184 | av->consumption_since_last_update__ = -max_carry; |
183 | } | 185 | } |
186 | delta.rel_value_us = delta_time; | ||
184 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 187 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
185 | "Tracker %p updated, have %u Bps, last update was %llu ms ago\n", av, | 188 | "Tracker %p updated, have %u Bps, last update was %s ago\n", av, |
186 | (unsigned int) av->available_bytes_per_s__, | 189 | (unsigned int) av->available_bytes_per_s__, |
187 | (unsigned long long) delta_time); | 190 | GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES)); |
188 | } | 191 | } |
189 | 192 | ||
190 | 193 | ||
@@ -251,22 +254,26 @@ GNUNET_BANDWIDTH_tracker_get_delay (struct GNUNET_BANDWIDTH_Tracker *av, | |||
251 | 254 | ||
252 | if (av->available_bytes_per_s__ == 0) | 255 | if (av->available_bytes_per_s__ == 0) |
253 | { | 256 | { |
254 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Tracker %p delay is infinity\n", av); | 257 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
258 | "Tracker %p delay is infinity\n", av); | ||
255 | return GNUNET_TIME_UNIT_FOREVER_REL; | 259 | return GNUNET_TIME_UNIT_FOREVER_REL; |
256 | } | 260 | } |
257 | update_tracker (av); | 261 | update_tracker (av); |
258 | bytes_needed = size + av->consumption_since_last_update__; | 262 | bytes_needed = size + av->consumption_since_last_update__; |
259 | if (bytes_needed <= 0) | 263 | if (bytes_needed <= 0) |
260 | { | 264 | { |
261 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Tracker %p delay for %u bytes is zero\n", av, | 265 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
266 | "Tracker %p delay for %u bytes is zero\n", av, | ||
262 | (unsigned int) size); | 267 | (unsigned int) size); |
263 | return GNUNET_TIME_UNIT_ZERO; | 268 | return GNUNET_TIME_UNIT_ZERO; |
264 | } | 269 | } |
265 | ret.rel_value = | 270 | ret.rel_value_us = |
266 | (1000LL * bytes_needed) / | 271 | (1000LL * 1000LL * bytes_needed) / |
267 | (unsigned long long) av->available_bytes_per_s__; | 272 | (unsigned long long) av->available_bytes_per_s__; |
268 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Tracker %p delay for %u bytes is %llu ms\n", | 273 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
269 | av, (unsigned int) size, (unsigned long long) ret.rel_value); | 274 | "Tracker %p delay for %u bytes is %s\n", |
275 | av, (unsigned int) size, | ||
276 | GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES)); | ||
270 | return ret; | 277 | return ret; |
271 | } | 278 | } |
272 | 279 | ||
@@ -293,7 +300,7 @@ GNUNET_BANDWIDTH_tracker_get_available (struct GNUNET_BANDWIDTH_Tracker * av) | |||
293 | (av->last_update__)); | 300 | (av->last_update__)); |
294 | used = av->consumption_since_last_update__; | 301 | used = av->consumption_since_last_update__; |
295 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 302 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
296 | "Tracker %p available bandwidth is %lld bytes\n", av, | 303 | "Tracker %p available bandwidth is %lld bytes\n", av, |
297 | (long long) (int64_t) (avail - used)); | 304 | (long long) (int64_t) (avail - used)); |
298 | return (int64_t) (avail - used); | 305 | return (int64_t) (avail - used); |
299 | } | 306 | } |
@@ -314,7 +321,8 @@ GNUNET_BANDWIDTH_tracker_update_quota (struct GNUNET_BANDWIDTH_Tracker *av, | |||
314 | uint32_t new_limit; | 321 | uint32_t new_limit; |
315 | 322 | ||
316 | new_limit = ntohl (bytes_per_second_limit.value__); | 323 | new_limit = ntohl (bytes_per_second_limit.value__); |
317 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Tracker %p bandwidth changed to %u Bps\n", av, | 324 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
325 | "Tracker %p bandwidth changed to %u Bps\n", av, | ||
318 | (unsigned int) new_limit); | 326 | (unsigned int) new_limit); |
319 | update_tracker (av); | 327 | update_tracker (av); |
320 | old_limit = av->available_bytes_per_s__; | 328 | old_limit = av->available_bytes_per_s__; |
diff --git a/src/util/client.c b/src/util/client.c index 811bb8e12..6c5e93ce4 100644 --- a/src/util/client.c +++ b/src/util/client.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2006, 2008, 2009, 2012 Christian Grothoff (and other contributing authors) | 3 | (C) 2001-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -409,7 +409,7 @@ GNUNET_CLIENT_connect (const char *service_name, | |||
409 | cfg)) | 409 | cfg)) |
410 | return NULL; | 410 | return NULL; |
411 | connection = do_connect (service_name, cfg, 0); | 411 | connection = do_connect (service_name, cfg, 0); |
412 | client = GNUNET_malloc (sizeof (struct GNUNET_CLIENT_Connection)); | 412 | client = GNUNET_new (struct GNUNET_CLIENT_Connection); |
413 | client->first_message = GNUNET_YES; | 413 | client->first_message = GNUNET_YES; |
414 | client->attempts = 1; | 414 | client->attempts = 1; |
415 | client->connection = connection; | 415 | client->connection = connection; |
@@ -536,7 +536,7 @@ receive_helper (void *cls, const void *buf, size_t available, | |||
536 | check_complete (client); | 536 | check_complete (client); |
537 | /* check for timeout */ | 537 | /* check for timeout */ |
538 | remaining = GNUNET_TIME_absolute_get_remaining (client->receive_timeout); | 538 | remaining = GNUNET_TIME_absolute_get_remaining (client->receive_timeout); |
539 | if (0 == remaining.rel_value) | 539 | if (0 == remaining.rel_value_us) |
540 | { | 540 | { |
541 | /* signal timeout! */ | 541 | /* signal timeout! */ |
542 | if (NULL != client->receiver_handler) | 542 | if (NULL != client->receiver_handler) |
@@ -1094,9 +1094,9 @@ client_notify (void *cls, size_t size, void *buf) | |||
1094 | if (NULL == buf) | 1094 | if (NULL == buf) |
1095 | { | 1095 | { |
1096 | delay = GNUNET_TIME_absolute_get_remaining (th->timeout); | 1096 | delay = GNUNET_TIME_absolute_get_remaining (th->timeout); |
1097 | delay.rel_value /= 2; | 1097 | delay.rel_value_us /= 2; |
1098 | if ((GNUNET_YES != th->auto_retry) || (0 == --th->attempts_left) || | 1098 | if ((GNUNET_YES != th->auto_retry) || (0 == --th->attempts_left) || |
1099 | (delay.rel_value < 1)|| | 1099 | (delay.rel_value_us < 1)|| |
1100 | (0 != (GNUNET_SCHEDULER_get_reason() & GNUNET_SCHEDULER_REASON_SHUTDOWN))) | 1100 | (0 != (GNUNET_SCHEDULER_get_reason() & GNUNET_SCHEDULER_REASON_SHUTDOWN))) |
1101 | { | 1101 | { |
1102 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1102 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 5b355b2e1..8f1c8e876 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2006, 2008, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2006-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -26,17 +26,15 @@ | |||
26 | */ | 26 | */ |
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_common.h" | 28 | #include "gnunet_common.h" |
29 | #include "gnunet_crypto_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_strings_lib.h" | ||
31 | #include "gnunet_time_lib.h" | ||
32 | |||
33 | #include <regex.h> | 30 | #include <regex.h> |
34 | 31 | ||
32 | |||
35 | /** | 33 | /** |
36 | * After how many milliseconds do we always print | 34 | * After how many milliseconds do we always print |
37 | * that "message X was repeated N times"? Use 12h. | 35 | * that "message X was repeated N times"? Use 12h. |
38 | */ | 36 | */ |
39 | #define BULK_DELAY_THRESHOLD (12 * 60 * 60 * 1000) | 37 | #define BULK_DELAY_THRESHOLD (12 * 60 * 60 * 1000LL * 1000LL) |
40 | 38 | ||
41 | /** | 39 | /** |
42 | * After how many repetitions do we always print | 40 | * After how many repetitions do we always print |
@@ -800,7 +798,7 @@ flush_bulk (const char *datestr) | |||
800 | char *last; | 798 | char *last; |
801 | const char *ft; | 799 | const char *ft; |
802 | 800 | ||
803 | if ((last_bulk_time.abs_value == 0) || (last_bulk_repeat == 0)) | 801 | if ((0 == last_bulk_time.abs_value_us) || (0 == last_bulk_repeat)) |
804 | return; | 802 | return; |
805 | rev = 0; | 803 | rev = 0; |
806 | last = memchr (last_bulk, '\0', BULK_TRACK_SIZE); | 804 | last = memchr (last_bulk, '\0', BULK_TRACK_SIZE); |
@@ -951,12 +949,13 @@ mylog (enum GNUNET_ErrorType kind, const char *comp, const char *message, | |||
951 | if (NULL != tmptr) | 949 | if (NULL != tmptr) |
952 | (void) setup_log_file (tmptr); | 950 | (void) setup_log_file (tmptr); |
953 | if ((0 != (kind & GNUNET_ERROR_TYPE_BULK)) && | 951 | if ((0 != (kind & GNUNET_ERROR_TYPE_BULK)) && |
954 | (last_bulk_time.abs_value != 0) && | 952 | (0 != last_bulk_time.abs_value_us) && |
955 | (0 == strncmp (buf, last_bulk, sizeof (last_bulk)))) | 953 | (0 == strncmp (buf, last_bulk, sizeof (last_bulk)))) |
956 | { | 954 | { |
957 | last_bulk_repeat++; | 955 | last_bulk_repeat++; |
958 | if ((GNUNET_TIME_absolute_get_duration (last_bulk_time).rel_value > | 956 | if ( (GNUNET_TIME_absolute_get_duration (last_bulk_time).rel_value_us > |
959 | BULK_DELAY_THRESHOLD) || (last_bulk_repeat > BULK_REPEAT_THRESHOLD)) | 957 | BULK_DELAY_THRESHOLD) || |
958 | (last_bulk_repeat > BULK_REPEAT_THRESHOLD) ) | ||
960 | flush_bulk (date); | 959 | flush_bulk (date); |
961 | return; | 960 | return; |
962 | } | 961 | } |
diff --git a/src/util/connection.c b/src/util/connection.c index ea35b04e1..bdfcd1add 100644 --- a/src/util/connection.c +++ b/src/util/connection.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009, 2012 Christian Grothoff (and other contributing authors) | 3 | (C) 2009-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -33,11 +33,8 @@ | |||
33 | 33 | ||
34 | #include "platform.h" | 34 | #include "platform.h" |
35 | #include "gnunet_common.h" | 35 | #include "gnunet_common.h" |
36 | #include "gnunet_connection_lib.h" | 36 | #include "gnunet_util_lib.h" |
37 | #include "gnunet_container_lib.h" | ||
38 | #include "gnunet_resolver_service.h" | 37 | #include "gnunet_resolver_service.h" |
39 | #include "gnunet_scheduler_lib.h" | ||
40 | #include "gnunet_server_lib.h" | ||
41 | 38 | ||
42 | 39 | ||
43 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 40 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) |
@@ -304,7 +301,7 @@ GNUNET_CONNECTION_create_from_existing (struct GNUNET_NETWORK_Handle *osSocket) | |||
304 | { | 301 | { |
305 | struct GNUNET_CONNECTION_Handle *connection; | 302 | struct GNUNET_CONNECTION_Handle *connection; |
306 | 303 | ||
307 | connection = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle)); | 304 | connection = GNUNET_new (struct GNUNET_CONNECTION_Handle); |
308 | connection->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; | 305 | connection->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; |
309 | connection->write_buffer = GNUNET_malloc (connection->write_buffer_size); | 306 | connection->write_buffer = GNUNET_malloc (connection->write_buffer_size); |
310 | connection->sock = osSocket; | 307 | connection->sock = osSocket; |
@@ -362,7 +359,7 @@ GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access, | |||
362 | if ((AF_INET6 == sa->sa_family) && (IN6_IS_ADDR_V4MAPPED (&v6->sin6_addr))) | 359 | if ((AF_INET6 == sa->sa_family) && (IN6_IS_ADDR_V4MAPPED (&v6->sin6_addr))) |
363 | { | 360 | { |
364 | /* convert to V4 address */ | 361 | /* convert to V4 address */ |
365 | v4 = GNUNET_malloc (sizeof (struct sockaddr_in)); | 362 | v4 = GNUNET_new (struct sockaddr_in); |
366 | memset (v4, 0, sizeof (struct sockaddr_in)); | 363 | memset (v4, 0, sizeof (struct sockaddr_in)); |
367 | v4->sin_family = AF_INET; | 364 | v4->sin_family = AF_INET; |
368 | #if HAVE_SOCKADDR_IN_SIN_LEN | 365 | #if HAVE_SOCKADDR_IN_SIN_LEN |
@@ -432,7 +429,7 @@ GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access, | |||
432 | GNUNET_free (uaddr); | 429 | GNUNET_free (uaddr); |
433 | return NULL; | 430 | return NULL; |
434 | } | 431 | } |
435 | connection = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle)); | 432 | connection = GNUNET_new (struct GNUNET_CONNECTION_Handle); |
436 | connection->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; | 433 | connection->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; |
437 | connection->write_buffer = GNUNET_malloc (connection->write_buffer_size); | 434 | connection->write_buffer = GNUNET_malloc (connection->write_buffer_size); |
438 | connection->addr = uaddr; | 435 | connection->addr = uaddr; |
@@ -800,7 +797,7 @@ GNUNET_CONNECTION_create_from_connect (const struct GNUNET_CONFIGURATION_Handle | |||
800 | struct GNUNET_CONNECTION_Handle *connection; | 797 | struct GNUNET_CONNECTION_Handle *connection; |
801 | 798 | ||
802 | GNUNET_assert (0 < strlen (hostname)); /* sanity check */ | 799 | GNUNET_assert (0 < strlen (hostname)); /* sanity check */ |
803 | connection = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle)); | 800 | connection = GNUNET_new (struct GNUNET_CONNECTION_Handle); |
804 | connection->cfg = cfg; | 801 | connection->cfg = cfg; |
805 | connection->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; | 802 | connection->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; |
806 | connection->write_buffer = GNUNET_malloc (connection->write_buffer_size); | 803 | connection->write_buffer = GNUNET_malloc (connection->write_buffer_size); |
@@ -834,7 +831,7 @@ GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct | |||
834 | size_t slen; | 831 | size_t slen; |
835 | 832 | ||
836 | GNUNET_assert (0 < strlen (unixpath)); /* sanity check */ | 833 | GNUNET_assert (0 < strlen (unixpath)); /* sanity check */ |
837 | un = GNUNET_malloc (sizeof (struct sockaddr_un)); | 834 | un = GNUNET_new (struct sockaddr_un); |
838 | un->sun_family = AF_UNIX; | 835 | un->sun_family = AF_UNIX; |
839 | slen = strlen (unixpath); | 836 | slen = strlen (unixpath); |
840 | if (slen >= sizeof (un->sun_path)) | 837 | if (slen >= sizeof (un->sun_path)) |
@@ -848,7 +845,7 @@ GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct | |||
848 | #if LINUX | 845 | #if LINUX |
849 | un->sun_path[0] = '\0'; | 846 | un->sun_path[0] = '\0'; |
850 | #endif | 847 | #endif |
851 | connection = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle)); | 848 | connection = GNUNET_new (struct GNUNET_CONNECTION_Handle); |
852 | connection->cfg = cfg; | 849 | connection->cfg = cfg; |
853 | connection->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; | 850 | connection->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE; |
854 | connection->write_buffer = GNUNET_malloc (connection->write_buffer_size); | 851 | connection->write_buffer = GNUNET_malloc (connection->write_buffer_size); |
@@ -1042,9 +1039,9 @@ receive_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1042 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) | 1039 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) |
1043 | { | 1040 | { |
1044 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1041 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1045 | "Receive from `%s' encounters error: timeout (%p)\n", | 1042 | "Receive from `%s' encounters error: timeout (%s, %p)\n", |
1046 | GNUNET_a2s (connection->addr, connection->addrlen), | 1043 | GNUNET_a2s (connection->addr, connection->addrlen), |
1047 | GNUNET_TIME_absolute_get_duration (connection->receive_timeout).rel_value, | 1044 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (connection->receive_timeout), GNUNET_YES), |
1048 | connection); | 1045 | connection); |
1049 | signal_receive_timeout (connection); | 1046 | signal_receive_timeout (connection); |
1050 | return; | 1047 | return; |
diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c index 507ecf661..cab13ae57 100644 --- a/src/util/gnunet-service-resolver.c +++ b/src/util/gnunet-service-resolver.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2007, 2008, 2009, 2012 Christian Grothoff (and other contributing authors) | 3 | (C) 2007-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -217,8 +217,8 @@ get_ip_as_string (struct GNUNET_SERVER_Client *client, | |||
217 | (0 != memcmp (pos->ip, ip, ip_len))) ) | 217 | (0 != memcmp (pos->ip, ip, ip_len))) ) |
218 | { | 218 | { |
219 | next = pos->next; | 219 | next = pos->next; |
220 | if (GNUNET_TIME_absolute_get_duration (pos->last_request).rel_value < | 220 | if (GNUNET_TIME_absolute_get_duration (pos->last_request).rel_value_us < |
221 | 60 * 60 * 1000) | 221 | 60 * 60 * 1000 * 1000LL) |
222 | { | 222 | { |
223 | GNUNET_CONTAINER_DLL_remove (cache_head, | 223 | GNUNET_CONTAINER_DLL_remove (cache_head, |
224 | cache_tail, | 224 | cache_tail, |
@@ -231,8 +231,8 @@ get_ip_as_string (struct GNUNET_SERVER_Client *client, | |||
231 | if (pos != NULL) | 231 | if (pos != NULL) |
232 | { | 232 | { |
233 | pos->last_request = now; | 233 | pos->last_request = now; |
234 | if (GNUNET_TIME_absolute_get_duration (pos->last_request).rel_value < | 234 | if (GNUNET_TIME_absolute_get_duration (pos->last_request).rel_value_us < |
235 | 60 * 60 * 1000) | 235 | 60 * 60 * 1000 * 1000LL) |
236 | { | 236 | { |
237 | GNUNET_free_non_null (pos->addr); | 237 | GNUNET_free_non_null (pos->addr); |
238 | pos->addr = NULL; | 238 | pos->addr = NULL; |
diff --git a/src/util/load.c b/src/util/load.c index 146e85095..06e284c4c 100644 --- a/src/util/load.c +++ b/src/util/load.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2010 Christian Grothoff (and other contributing authors) | 3 | (C) 2010, 2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -24,7 +24,7 @@ | |||
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_load_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | 28 | ||
29 | 29 | ||
30 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 30 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) |
@@ -87,18 +87,18 @@ internal_update (struct GNUNET_LOAD_Value *load) | |||
87 | struct GNUNET_TIME_Relative delta; | 87 | struct GNUNET_TIME_Relative delta; |
88 | unsigned int n; | 88 | unsigned int n; |
89 | 89 | ||
90 | if (load->autodecline.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value) | 90 | if (load->autodecline.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) |
91 | return; | 91 | return; |
92 | delta = GNUNET_TIME_absolute_get_duration (load->last_update); | 92 | delta = GNUNET_TIME_absolute_get_duration (load->last_update); |
93 | if (delta.rel_value < load->autodecline.rel_value) | 93 | if (delta.rel_value_us < load->autodecline.rel_value_us) |
94 | return; | 94 | return; |
95 | if (load->autodecline.rel_value == 0) | 95 | if (0 == load->autodecline.rel_value_us) |
96 | { | 96 | { |
97 | load->runavg_delay = 0.0; | 97 | load->runavg_delay = 0.0; |
98 | load->load = 0; | 98 | load->load = 0; |
99 | return; | 99 | return; |
100 | } | 100 | } |
101 | n = delta.rel_value / load->autodecline.rel_value; | 101 | n = delta.rel_value_us / load->autodecline.rel_value_us; |
102 | if (n > 16) | 102 | if (n > 16) |
103 | { | 103 | { |
104 | load->runavg_delay = 0.0; | 104 | load->runavg_delay = 0.0; |
@@ -126,7 +126,7 @@ GNUNET_LOAD_value_init (struct GNUNET_TIME_Relative autodecline) | |||
126 | { | 126 | { |
127 | struct GNUNET_LOAD_Value *ret; | 127 | struct GNUNET_LOAD_Value *ret; |
128 | 128 | ||
129 | ret = GNUNET_malloc (sizeof (struct GNUNET_LOAD_Value)); | 129 | ret = GNUNET_new (struct GNUNET_LOAD_Value); |
130 | ret->autodecline = autodecline; | 130 | ret->autodecline = autodecline; |
131 | ret->last_update = GNUNET_TIME_absolute_get (); | 131 | ret->last_update = GNUNET_TIME_absolute_get (); |
132 | return ret; | 132 | return ret; |
diff --git a/src/util/network.c b/src/util/network.c index 7a51a8b67..8398b9fab 100644 --- a/src/util/network.c +++ b/src/util/network.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009, 2012 Christian Grothoff (and other contributing authors) | 3 | (C) 2009-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -1332,7 +1332,7 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, | |||
1332 | } | 1332 | } |
1333 | 1333 | ||
1334 | if ((nfds == 0) && | 1334 | if ((nfds == 0) && |
1335 | (timeout.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value) | 1335 | (timeout.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) |
1336 | #ifdef MINGW | 1336 | #ifdef MINGW |
1337 | && handles == 0 | 1337 | && handles == 0 |
1338 | #endif | 1338 | #endif |
@@ -1345,25 +1345,26 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, | |||
1345 | "select"); | 1345 | "select"); |
1346 | } | 1346 | } |
1347 | #ifndef MINGW | 1347 | #ifndef MINGW |
1348 | tv.tv_sec = timeout.rel_value / GNUNET_TIME_UNIT_SECONDS.rel_value; | 1348 | tv.tv_sec = timeout.rel_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us; |
1349 | tv.tv_usec = | 1349 | tv.tv_usec = |
1350 | 1000 * (timeout.rel_value - | 1350 | (timeout.rel_value_us - |
1351 | (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value)); | 1351 | (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value_us)); |
1352 | return select (nfds, (rfds != NULL) ? &rfds->sds : NULL, | 1352 | return select (nfds, |
1353 | (wfds != NULL) ? &wfds->sds : NULL, | 1353 | (NULL != rfds) ? &rfds->sds : NULL, |
1354 | (efds != NULL) ? &efds->sds : NULL, | 1354 | (NULL != wfds) ? &wfds->sds : NULL, |
1355 | (timeout.rel_value == | 1355 | (NULL != efds) ? &efds->sds : NULL, |
1356 | GNUNET_TIME_UNIT_FOREVER_REL.rel_value) ? NULL : &tv); | 1356 | (timeout.rel_value_us == |
1357 | GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) ? NULL : &tv); | ||
1357 | 1358 | ||
1358 | #else | 1359 | #else |
1359 | #define SAFE_FD_ISSET(fd, set) (set != NULL && FD_ISSET(fd, set)) | 1360 | #define SAFE_FD_ISSET(fd, set) (set != NULL && FD_ISSET(fd, set)) |
1360 | /* calculate how long we need to wait in milliseconds */ | 1361 | /* calculate how long we need to wait in milliseconds */ |
1361 | if (timeout.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value) | 1362 | if (timeout.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) |
1362 | ms_total = INFINITE; | 1363 | ms_total = INFINITE; |
1363 | else | 1364 | else |
1364 | { | 1365 | { |
1365 | ms_total = timeout.rel_value / GNUNET_TIME_UNIT_MILLISECONDS.rel_value; | 1366 | ms_total = timeout.rel_value_us / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us; |
1366 | if (timeout.rel_value / GNUNET_TIME_UNIT_MILLISECONDS.rel_value > 0xFFFFFFFFLL - 1) | 1367 | if (timeout.rel_value_us / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us > 0xFFFFFFFFLL - 1) |
1367 | { | 1368 | { |
1368 | GNUNET_break (0); | 1369 | GNUNET_break (0); |
1369 | ms_total = 0xFFFFFFFF - 1; | 1370 | ms_total = 0xFFFFFFFF - 1; |
@@ -1376,7 +1377,7 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, | |||
1376 | return 0; | 1377 | return 0; |
1377 | } | 1378 | } |
1378 | 1379 | ||
1379 | if (select_thread == NULL) | 1380 | if (NULL == select_thread) |
1380 | { | 1381 | { |
1381 | SOCKET select_listening_socket = -1; | 1382 | SOCKET select_listening_socket = -1; |
1382 | struct sockaddr_in s_in; | 1383 | struct sockaddr_in s_in; |
@@ -1742,15 +1743,16 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, | |||
1742 | if (nfds > 0) | 1743 | if (nfds > 0) |
1743 | { | 1744 | { |
1744 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1745 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1745 | "Adding the socket event to the array as %d\n", nhandles); | 1746 | "Adding the socket event to the array as %d\n", |
1747 | nhandles); | ||
1746 | handle_array[nhandles++] = select_finished_event; | 1748 | handle_array[nhandles++] = select_finished_event; |
1747 | if (timeout.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value) | 1749 | if (timeout.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) |
1748 | sp.tv = NULL; | 1750 | sp.tv = NULL; |
1749 | else | 1751 | else |
1750 | { | 1752 | { |
1751 | select_timeout.tv_sec = timeout.rel_value / GNUNET_TIME_UNIT_SECONDS.rel_value; | 1753 | select_timeout.tv_sec = timeout.rel_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us; |
1752 | select_timeout.tv_usec = 1000 * (timeout.rel_value - | 1754 | select_timeout.tv_usec =(timeout.rel_value_us - |
1753 | (select_timeout.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value)); | 1755 | (select_timeout.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value_us)); |
1754 | sp.tv = &select_timeout; | 1756 | sp.tv = &select_timeout; |
1755 | } | 1757 | } |
1756 | FD_SET (select_wakeup_socket, &aread); | 1758 | FD_SET (select_wakeup_socket, &aread); |
diff --git a/src/util/perf_crypto_hash.c b/src/util/perf_crypto_hash.c index 930e99844..affd4a2d5 100644 --- a/src/util/perf_crypto_hash.c +++ b/src/util/perf_crypto_hash.c | |||
@@ -53,9 +53,9 @@ main (int argc, char *argv[]) | |||
53 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), | 53 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), |
54 | GNUNET_YES)); | 54 | GNUNET_YES)); |
55 | GAUGER ("UTIL", "Cryptographic hashing", | 55 | GAUGER ("UTIL", "Cryptographic hashing", |
56 | 1024 * 64 * 1024 / (1 + | 56 | 64 * 1024 / (1 + |
57 | GNUNET_TIME_absolute_get_duration | 57 | GNUNET_TIME_absolute_get_duration |
58 | (start).rel_value), "kb/s"); | 58 | (start).rel_value_us / 1000LL), "kb/ms"); |
59 | return 0; | 59 | return 0; |
60 | } | 60 | } |
61 | 61 | ||
diff --git a/src/util/perf_malloc.c b/src/util/perf_malloc.c index 31f08dff0..f25529269 100644 --- a/src/util/perf_malloc.c +++ b/src/util/perf_malloc.c | |||
@@ -53,13 +53,13 @@ main (int argc, char *argv[]) | |||
53 | 53 | ||
54 | start = GNUNET_TIME_absolute_get (); | 54 | start = GNUNET_TIME_absolute_get (); |
55 | kb = perfMalloc (); | 55 | kb = perfMalloc (); |
56 | printf ("Malloc perf took %llu ms\n", | 56 | printf ("Malloc perf took %s\n", |
57 | (unsigned long long) | 57 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), |
58 | GNUNET_TIME_absolute_get_duration (start).rel_value); | 58 | GNUNET_YES)); |
59 | GAUGER ("UTIL", "Allocation", | 59 | GAUGER ("UTIL", "Allocation", |
60 | kb / 1024 / (1 + | 60 | kb / 1024 / (1 + |
61 | GNUNET_TIME_absolute_get_duration | 61 | GNUNET_TIME_absolute_get_duration |
62 | (start).rel_value), "kb/s"); | 62 | (start).rel_value_us / 1000LL), "kb/ms"); |
63 | return 0; | 63 | return 0; |
64 | } | 64 | } |
65 | 65 | ||
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index 7acc0f87f..9a2228da0 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009, 2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2009-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -24,13 +24,9 @@ | |||
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_getopt_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_os_lib.h" | ||
29 | #include "gnunet_client_lib.h" | ||
30 | #include "gnunet_container_lib.h" | ||
31 | #include "gnunet_protocols.h" | 28 | #include "gnunet_protocols.h" |
32 | #include "gnunet_resolver_service.h" | 29 | #include "gnunet_resolver_service.h" |
33 | #include "gnunet_server_lib.h" | ||
34 | #include "resolver.h" | 30 | #include "resolver.h" |
35 | 31 | ||
36 | #define LOG(kind,...) GNUNET_log_from (kind, "resolver-api", __VA_ARGS__) | 32 | #define LOG(kind,...) GNUNET_log_from (kind, "resolver-api", __VA_ARGS__) |
@@ -703,8 +699,8 @@ reconnect () | |||
703 | } | 699 | } |
704 | } | 700 | } |
705 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 701 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
706 | "Will try to connect to DNS service in %llu ms\n", | 702 | "Will try to connect to DNS service in %s\n", |
707 | (unsigned long long) backoff.rel_value); | 703 | GNUNET_STRINGS_relative_time_to_string (backoff, GNUNET_YES)); |
708 | GNUNET_assert (NULL != resolver_cfg); | 704 | GNUNET_assert (NULL != resolver_cfg); |
709 | r_task = GNUNET_SCHEDULER_add_delayed (backoff, &reconnect_task, NULL); | 705 | r_task = GNUNET_SCHEDULER_add_delayed (backoff, &reconnect_task, NULL); |
710 | backoff = GNUNET_TIME_STD_BACKOFF (backoff); | 706 | backoff = GNUNET_TIME_STD_BACKOFF (backoff); |
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 23f683808..5b90d7e4f 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2009, 2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2009-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -300,7 +300,7 @@ update_sets (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws, | |||
300 | if (pos != NULL) | 300 | if (pos != NULL) |
301 | { | 301 | { |
302 | to = GNUNET_TIME_absolute_get_difference (now, pos->timeout); | 302 | to = GNUNET_TIME_absolute_get_difference (now, pos->timeout); |
303 | if (timeout->rel_value > to.rel_value) | 303 | if (timeout->rel_value_us > to.rel_value_us) |
304 | *timeout = to; | 304 | *timeout = to; |
305 | if (pos->reason != 0) | 305 | if (pos->reason != 0) |
306 | *timeout = GNUNET_TIME_UNIT_ZERO; | 306 | *timeout = GNUNET_TIME_UNIT_ZERO; |
@@ -308,10 +308,10 @@ update_sets (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws, | |||
308 | pos = pending; | 308 | pos = pending; |
309 | while (pos != NULL) | 309 | while (pos != NULL) |
310 | { | 310 | { |
311 | if (pos->timeout.abs_value != GNUNET_TIME_UNIT_FOREVER_ABS.abs_value) | 311 | if (pos->timeout.abs_value_us != GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) |
312 | { | 312 | { |
313 | to = GNUNET_TIME_absolute_get_difference (now, pos->timeout); | 313 | to = GNUNET_TIME_absolute_get_difference (now, pos->timeout); |
314 | if (timeout->rel_value > to.rel_value) | 314 | if (timeout->rel_value_us > to.rel_value_us) |
315 | *timeout = to; | 315 | *timeout = to; |
316 | } | 316 | } |
317 | if (pos->read_fd != -1) | 317 | if (pos->read_fd != -1) |
@@ -373,7 +373,7 @@ is_ready (struct Task *task, struct GNUNET_TIME_Absolute now, | |||
373 | enum GNUNET_SCHEDULER_Reason reason; | 373 | enum GNUNET_SCHEDULER_Reason reason; |
374 | 374 | ||
375 | reason = task->reason; | 375 | reason = task->reason; |
376 | if (now.abs_value >= task->timeout.abs_value) | 376 | if (now.abs_value_us >= task->timeout.abs_value_us) |
377 | reason |= GNUNET_SCHEDULER_REASON_TIMEOUT; | 377 | reason |= GNUNET_SCHEDULER_REASON_TIMEOUT; |
378 | if ((0 == (reason & GNUNET_SCHEDULER_REASON_READ_READY)) && | 378 | if ((0 == (reason & GNUNET_SCHEDULER_REASON_READ_READY)) && |
379 | (((task->read_fd != -1) && | 379 | (((task->read_fd != -1) && |
@@ -433,7 +433,7 @@ check_ready (const struct GNUNET_NETWORK_FDSet *rs, | |||
433 | while (pos != NULL) | 433 | while (pos != NULL) |
434 | { | 434 | { |
435 | next = pos->next; | 435 | next = pos->next; |
436 | if (now.abs_value >= pos->timeout.abs_value) | 436 | if (now.abs_value_us >= pos->timeout.abs_value_us) |
437 | pos->reason |= GNUNET_SCHEDULER_REASON_TIMEOUT; | 437 | pos->reason |= GNUNET_SCHEDULER_REASON_TIMEOUT; |
438 | if (0 == pos->reason) | 438 | if (0 == pos->reason) |
439 | break; | 439 | break; |
@@ -569,8 +569,8 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws) | |||
569 | current_lifeness = pos->lifeness; | 569 | current_lifeness = pos->lifeness; |
570 | active_task = pos; | 570 | active_task = pos; |
571 | #if PROFILE_DELAYS | 571 | #if PROFILE_DELAYS |
572 | if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value > | 572 | if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value_us > |
573 | DELAY_THRESHOLD.rel_value) | 573 | DELAY_THRESHOLD.rel_value_us) |
574 | { | 574 | { |
575 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 575 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
576 | "Task %llu took %s to be scheduled\n", | 576 | "Task %llu took %s to be scheduled\n", |
@@ -777,7 +777,7 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls) | |||
777 | GNUNET_abort (); | 777 | GNUNET_abort (); |
778 | break; | 778 | break; |
779 | } | 779 | } |
780 | if ((ret == 0) && (timeout.rel_value == 0) && (busy_wait_warning > 16)) | 780 | if ((0 == ret) && (0 == timeout.rel_value_us) && (busy_wait_warning > 16)) |
781 | { | 781 | { |
782 | LOG (GNUNET_ERROR_TYPE_WARNING, _("Looks like we're busy waiting...\n")); | 782 | LOG (GNUNET_ERROR_TYPE_WARNING, _("Looks like we're busy waiting...\n")); |
783 | sleep (1); /* mitigate */ | 783 | sleep (1); /* mitigate */ |
@@ -1091,7 +1091,7 @@ GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, | |||
1091 | prev = pending_timeout_last; | 1091 | prev = pending_timeout_last; |
1092 | if (prev != NULL) | 1092 | if (prev != NULL) |
1093 | { | 1093 | { |
1094 | if (prev->timeout.abs_value > t->timeout.abs_value) | 1094 | if (prev->timeout.abs_value_us > t->timeout.abs_value_us) |
1095 | prev = NULL; | 1095 | prev = NULL; |
1096 | else | 1096 | else |
1097 | pos = prev->next; /* heuristic success! */ | 1097 | pos = prev->next; /* heuristic success! */ |
@@ -1102,8 +1102,8 @@ GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, | |||
1102 | pos = pending_timeout; | 1102 | pos = pending_timeout; |
1103 | } | 1103 | } |
1104 | while ((pos != NULL) && | 1104 | while ((pos != NULL) && |
1105 | ((pos->timeout.abs_value <= t->timeout.abs_value) || | 1105 | ((pos->timeout.abs_value_us <= t->timeout.abs_value_us) || |
1106 | (pos->reason != 0))) | 1106 | (0 != pos->reason))) |
1107 | { | 1107 | { |
1108 | prev = pos; | 1108 | prev = pos; |
1109 | pos = pos->next; | 1109 | pos = pos->next; |
diff --git a/src/util/server.c b/src/util/server.c index b2264479a..05463e1cb 100644 --- a/src/util/server.c +++ b/src/util/server.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009, 2012 Christian Grothoff (and other contributing authors) | 3 | (C) 2009-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -1032,8 +1032,8 @@ process_mst (struct GNUNET_SERVER_Client *client, int ret) | |||
1032 | if (GNUNET_OK == ret) | 1032 | if (GNUNET_OK == ret) |
1033 | { | 1033 | { |
1034 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1034 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1035 | "Server re-enters receive loop, timeout: %llu.\n", | 1035 | "Server re-enters receive loop, timeout: %s.\n", |
1036 | client->idle_timeout.rel_value); | 1036 | GNUNET_STRINGS_relative_time_to_string (client->idle_timeout, GNUNET_YES)); |
1037 | client->receive_pending = GNUNET_YES; | 1037 | client->receive_pending = GNUNET_YES; |
1038 | GNUNET_CONNECTION_receive (client->connection, | 1038 | GNUNET_CONNECTION_receive (client->connection, |
1039 | GNUNET_SERVER_MAX_MESSAGE_SIZE - 1, | 1039 | GNUNET_SERVER_MAX_MESSAGE_SIZE - 1, |
@@ -1094,7 +1094,7 @@ process_incoming (void *cls, const void *buf, size_t available, | |||
1094 | if ((NULL == buf) && (0 == available) && (NULL == addr) && (0 == errCode) && | 1094 | if ((NULL == buf) && (0 == available) && (NULL == addr) && (0 == errCode) && |
1095 | (GNUNET_YES != client->shutdown_now) && (NULL != server) && | 1095 | (GNUNET_YES != client->shutdown_now) && (NULL != server) && |
1096 | (GNUNET_YES == GNUNET_CONNECTION_check (client->connection)) && | 1096 | (GNUNET_YES == GNUNET_CONNECTION_check (client->connection)) && |
1097 | (end.abs_value > now.abs_value)) | 1097 | (end.abs_value_us > now.abs_value_us)) |
1098 | { | 1098 | { |
1099 | /* wait longer, timeout changed (i.e. due to us sending) */ | 1099 | /* wait longer, timeout changed (i.e. due to us sending) */ |
1100 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1100 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/util/speedup.c b/src/util/speedup.c index 6cb8a4e05..2482decea 100644 --- a/src/util/speedup.c +++ b/src/util/speedup.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2006, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2011-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -24,8 +24,7 @@ | |||
24 | * @brief functions to speedup peer execution by manipulation system time | 24 | * @brief functions to speedup peer execution by manipulation system time |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_time_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_scheduler_lib.h" | ||
29 | 28 | ||
30 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 29 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) |
31 | 30 | ||
@@ -45,10 +44,11 @@ do_speedup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
45 | speedup_task = GNUNET_SCHEDULER_NO_TASK; | 44 | speedup_task = GNUNET_SCHEDULER_NO_TASK; |
46 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) | 45 | if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) |
47 | return; | 46 | return; |
48 | current_offset += delta.rel_value; | 47 | current_offset += delta.rel_value_us; |
49 | GNUNET_TIME_set_offset (current_offset); | 48 | GNUNET_TIME_set_offset (current_offset); |
50 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 49 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
51 | "Speeding up execution time by %llu ms\n", delta.rel_value); | 50 | "Speeding up execution time by %s\n", |
51 | GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_NO)); | ||
52 | speedup_task = GNUNET_SCHEDULER_add_delayed (interval, &do_speedup, NULL); | 52 | speedup_task = GNUNET_SCHEDULER_add_delayed (interval, &do_speedup, NULL); |
53 | } | 53 | } |
54 | 54 | ||
@@ -67,15 +67,18 @@ GNUNET_SPEEDUP_start_ (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
67 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "SPEEDUP_DELTA", &delta)) | 67 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "SPEEDUP_DELTA", &delta)) |
68 | return GNUNET_SYSERR; | 68 | return GNUNET_SYSERR; |
69 | 69 | ||
70 | if ((0 == interval.rel_value) || (0 == delta.rel_value)) | 70 | if ((0 == interval.rel_value_us) || (0 == delta.rel_value_us)) |
71 | { | 71 | { |
72 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 72 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
73 | "Speed up disabled\n"); | 73 | "Speed up disabled\n"); |
74 | return GNUNET_OK; | 74 | return GNUNET_OK; |
75 | } | 75 | } |
76 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 76 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
77 | "Speed up execution time %llu ms every %llu ms\n", | 77 | "Speed up execution by %s\n", |
78 | delta.rel_value, interval.rel_value); | 78 | GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_NO)); |
79 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
80 | "Speed up executed every %s\n", | ||
81 | GNUNET_STRINGS_relative_time_to_string (interval, GNUNET_NO)); | ||
79 | speedup_task = GNUNET_SCHEDULER_add_now_with_lifeness (GNUNET_NO, &do_speedup, NULL); | 82 | speedup_task = GNUNET_SCHEDULER_add_now_with_lifeness (GNUNET_NO, &do_speedup, NULL); |
80 | return GNUNET_OK; | 83 | return GNUNET_OK; |
81 | } | 84 | } |
@@ -92,7 +95,8 @@ GNUNET_SPEEDUP_stop_ ( ) | |||
92 | GNUNET_SCHEDULER_cancel (speedup_task); | 95 | GNUNET_SCHEDULER_cancel (speedup_task); |
93 | speedup_task = GNUNET_SCHEDULER_NO_TASK; | 96 | speedup_task = GNUNET_SCHEDULER_NO_TASK; |
94 | } | 97 | } |
95 | if ((0 != interval.rel_value) && (0 != delta.rel_value)) | 98 | if ( (0 != interval.rel_value_us) && |
99 | (0 != delta.rel_value_us) ) | ||
96 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 100 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
97 | "Stopped execution speed up\n"); | 101 | "Stopped execution speed up\n"); |
98 | } | 102 | } |
diff --git a/src/util/strings.c b/src/util/strings.c index 8bbc904bc..da02a9c4f 100644 --- a/src/util/strings.c +++ b/src/util/strings.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2005, 2006 Christian Grothoff (and other contributing authors) | 3 | (C) 2005-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -300,18 +300,19 @@ GNUNET_STRINGS_fancy_time_to_relative (const char *fancy_time, | |||
300 | { | 300 | { |
301 | static const struct ConversionTable table[] = | 301 | static const struct ConversionTable table[] = |
302 | { | 302 | { |
303 | { "ms", 1}, | 303 | { "us", 1}, |
304 | { "s", 1000}, | 304 | { "ms", 1000 }, |
305 | { "\"", 1000}, | 305 | { "s", 1000 * 1000LL }, |
306 | { "m", 60 * 1000}, | 306 | { "\"", 1000 * 1000LL }, |
307 | { "min", 60 * 1000}, | 307 | { "m", 60 * 1000 * 1000LL}, |
308 | { "minutes", 60 * 1000}, | 308 | { "min", 60 * 1000 * 1000LL}, |
309 | { "'", 60 * 1000}, | 309 | { "minutes", 60 * 1000 * 1000LL}, |
310 | { "h", 60 * 60 * 1000}, | 310 | { "'", 60 * 1000 * 1000LL}, |
311 | { "d", 24 * 60 * 60 * 1000}, | 311 | { "h", 60 * 60 * 1000 * 1000LL}, |
312 | { "day", 24 * 60 * 60 * 1000}, | 312 | { "d", 24 * 60 * 60 * 1000LL * 1000LL}, |
313 | { "days", 24 * 60 * 60 * 1000}, | 313 | { "day", 24 * 60 * 60 * 1000LL * 1000LL}, |
314 | { "a", 31536000000LL /* year */ }, | 314 | { "days", 24 * 60 * 60 * 1000LL * 1000LL}, |
315 | { "a", 31536000000000LL /* year */ }, | ||
315 | { NULL, 0} | 316 | { NULL, 0} |
316 | }; | 317 | }; |
317 | int ret; | 318 | int ret; |
@@ -325,7 +326,7 @@ GNUNET_STRINGS_fancy_time_to_relative (const char *fancy_time, | |||
325 | ret = convert_with_table (fancy_time, | 326 | ret = convert_with_table (fancy_time, |
326 | table, | 327 | table, |
327 | &val); | 328 | &val); |
328 | rtime->rel_value = (uint64_t) val; | 329 | rtime->rel_value_us = (uint64_t) val; |
329 | return ret; | 330 | return ret; |
330 | } | 331 | } |
331 | 332 | ||
@@ -363,9 +364,9 @@ GNUNET_STRINGS_fancy_time_to_absolute (const char *fancy_time, | |||
363 | (NULL == strptime (fancy_time, "%Y", &tv)) ) | 364 | (NULL == strptime (fancy_time, "%Y", &tv)) ) |
364 | return GNUNET_SYSERR; | 365 | return GNUNET_SYSERR; |
365 | t = mktime (&tv); | 366 | t = mktime (&tv); |
366 | atime->abs_value = (uint64_t) ((uint64_t) t * 1000LL); | 367 | atime->abs_value_us = (uint64_t) ((uint64_t) t * 1000LL * 1000LL); |
367 | #if LINUX | 368 | #if LINUX |
368 | atime->abs_value -= 1000LL * timezone; | 369 | atime->abs_value_us -= 1000LL * 1000LL * timezone; |
369 | #endif | 370 | #endif |
370 | return GNUNET_OK; | 371 | return GNUNET_OK; |
371 | } | 372 | } |
@@ -380,7 +381,10 @@ GNUNET_STRINGS_fancy_time_to_absolute (const char *fancy_time, | |||
380 | * string is returned. | 381 | * string is returned. |
381 | */ | 382 | */ |
382 | char * | 383 | char * |
383 | GNUNET_STRINGS_conv (const char *input, size_t len, const char *input_charset, const char *output_charset) | 384 | GNUNET_STRINGS_conv (const char *input, |
385 | size_t len, | ||
386 | const char *input_charset, | ||
387 | const char *output_charset) | ||
384 | { | 388 | { |
385 | char *ret; | 389 | char *ret; |
386 | uint8_t *u8_string; | 390 | uint8_t *u8_string; |
@@ -634,41 +638,48 @@ GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta, | |||
634 | int do_round) | 638 | int do_round) |
635 | { | 639 | { |
636 | static char buf[128]; | 640 | static char buf[128]; |
637 | const char *unit = _( /* time unit */ "ms"); | 641 | const char *unit = _( /* time unit */ "µs"); |
638 | uint64_t dval = delta.rel_value; | 642 | uint64_t dval = delta.rel_value_us; |
639 | 643 | ||
640 | if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value == delta.rel_value) | 644 | if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == delta.rel_value_us) |
641 | return _("forever"); | 645 | return _("forever"); |
642 | if (0 == delta.rel_value) | 646 | if (0 == delta.rel_value_us) |
643 | return _("0 ms"); | 647 | return _("0 ms"); |
644 | if ( ( (GNUNET_YES == do_round) && | 648 | if ( ( (GNUNET_YES == do_round) && |
645 | (dval > 5 * 1000) ) || | 649 | (dval > 5 * 1000) ) || |
646 | (0 == (dval % 1000) )) | 650 | (0 == (dval % 1000) )) |
647 | { | 651 | { |
648 | dval = dval / 1000; | 652 | dval = dval / 1000; |
649 | unit = _( /* time unit */ "s"); | 653 | unit = _( /* time unit */ "ms"); |
650 | if ( ( (GNUNET_YES == do_round) && | 654 | if ( ( (GNUNET_YES == do_round) && |
651 | (dval > 5 * 60) ) || | 655 | (dval > 5 * 1000) ) || |
652 | (0 == (dval % 60) ) ) | 656 | (0 == (dval % 1000) )) |
653 | { | 657 | { |
654 | dval = dval / 60; | 658 | dval = dval / 1000; |
655 | unit = _( /* time unit */ "m"); | 659 | unit = _( /* time unit */ "s"); |
656 | if ( ( (GNUNET_YES == do_round) && | 660 | if ( ( (GNUNET_YES == do_round) && |
657 | (dval > 5 * 60) ) || | 661 | (dval > 5 * 60) ) || |
658 | (0 == (dval % 60) )) | 662 | (0 == (dval % 60) ) ) |
659 | { | 663 | { |
660 | dval = dval / 60; | 664 | dval = dval / 60; |
661 | unit = _( /* time unit */ "h"); | 665 | unit = _( /* time unit */ "m"); |
662 | if ( ( (GNUNET_YES == do_round) && | 666 | if ( ( (GNUNET_YES == do_round) && |
663 | (dval > 5 * 24) ) || | 667 | (dval > 5 * 60) ) || |
664 | (0 == (dval % 24)) ) | 668 | (0 == (dval % 60) )) |
665 | { | 669 | { |
666 | dval = dval / 24; | 670 | dval = dval / 60; |
667 | if (1 == dval) | 671 | unit = _( /* time unit */ "h"); |
668 | unit = _( /* time unit */ "day"); | 672 | if ( ( (GNUNET_YES == do_round) && |
669 | else | 673 | (dval > 5 * 24) ) || |
670 | unit = _( /* time unit */ "days"); | 674 | (0 == (dval % 24)) ) |
671 | } | 675 | { |
676 | dval = dval / 24; | ||
677 | if (1 == dval) | ||
678 | unit = _( /* time unit */ "day"); | ||
679 | else | ||
680 | unit = _( /* time unit */ "days"); | ||
681 | } | ||
682 | } | ||
672 | } | 683 | } |
673 | } | 684 | } |
674 | } | 685 | } |
@@ -693,9 +704,9 @@ GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t) | |||
693 | time_t tt; | 704 | time_t tt; |
694 | struct tm *tp; | 705 | struct tm *tp; |
695 | 706 | ||
696 | if (t.abs_value == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value) | 707 | if (t.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) |
697 | return _("end of time"); | 708 | return _("end of time"); |
698 | tt = t.abs_value / 1000; | 709 | tt = t.abs_value_us / 1000LL / 1000LL; |
699 | tp = gmtime (&tt); | 710 | tp = gmtime (&tt); |
700 | strftime (buf, sizeof (buf), "%a %b %d %H:%M:%S %Y", tp); | 711 | strftime (buf, sizeof (buf), "%a %b %d %H:%M:%S %Y", tp); |
701 | return buf; | 712 | return buf; |
diff --git a/src/util/test_common_logging_dummy.c b/src/util/test_common_logging_dummy.c index a1f479976..a360d5dee 100644 --- a/src/util/test_common_logging_dummy.c +++ b/src/util/test_common_logging_dummy.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2008 Christian Grothoff (and other contributing authors) | 3 | (C) 2008-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -59,7 +59,7 @@ expensive_func () | |||
59 | GNUNET_log (kind, "L%s %d\n", lvl, expensive_func());\ | 59 | GNUNET_log (kind, "L%s %d\n", lvl, expensive_func());\ |
60 | t2 = GNUNET_TIME_absolute_get ();\ | 60 | t2 = GNUNET_TIME_absolute_get ();\ |
61 | printf ("1%s %llu\n", lvl,\ | 61 | printf ("1%s %llu\n", lvl,\ |
62 | (unsigned long long) GNUNET_TIME_absolute_get_difference (t1, t2).rel_value); \ | 62 | (unsigned long long) GNUNET_TIME_absolute_get_difference (t1, t2).rel_value_us); \ |
63 | } | 63 | } |
64 | 64 | ||
65 | #define pr2(kind,lvl) {\ | 65 | #define pr2(kind,lvl) {\ |
@@ -68,7 +68,7 @@ expensive_func () | |||
68 | GNUNET_log (kind, "L%s %d\n", lvl, expensive_func());\ | 68 | GNUNET_log (kind, "L%s %d\n", lvl, expensive_func());\ |
69 | t2 = GNUNET_TIME_absolute_get ();\ | 69 | t2 = GNUNET_TIME_absolute_get ();\ |
70 | printf ("2%s %llu\n", lvl,\ | 70 | printf ("2%s %llu\n", lvl,\ |
71 | (unsigned long long) GNUNET_TIME_absolute_get_difference (t1, t2).rel_value); \ | 71 | (unsigned long long) GNUNET_TIME_absolute_get_difference (t1, t2).rel_value_us); \ |
72 | } | 72 | } |
73 | 73 | ||
74 | int | 74 | int |
diff --git a/src/util/test_crypto_ecc.c b/src/util/test_crypto_ecc.c index 00d264e0f..bb5fb002f 100644 --- a/src/util/test_crypto_ecc.c +++ b/src/util/test_crypto_ecc.c | |||
@@ -166,9 +166,9 @@ testSignPerformance () | |||
166 | continue; | 166 | continue; |
167 | } | 167 | } |
168 | } | 168 | } |
169 | printf ("%d ECC sign operations %llu ms\n", ITER, | 169 | printf ("%d ECC sign operations %s\n", ITER, |
170 | (unsigned long long) | 170 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), |
171 | GNUNET_TIME_absolute_get_duration (start).rel_value); | 171 | GNUNET_YES)); |
172 | return ok; | 172 | return ok; |
173 | } | 173 | } |
174 | #endif | 174 | #endif |
diff --git a/src/util/test_scheduler_delay.c b/src/util/test_scheduler_delay.c index 132066979..ce96213c7 100644 --- a/src/util/test_scheduler_delay.c +++ b/src/util/test_scheduler_delay.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2003, 2004, 2006 Christian Grothoff (and other contributing authors) | 3 | (C) 2001-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -20,13 +20,11 @@ | |||
20 | /** | 20 | /** |
21 | * @file util/test_scheduler_delay.c | 21 | * @file util/test_scheduler_delay.c |
22 | * @brief testcase for delay of scheduler, measures how | 22 | * @brief testcase for delay of scheduler, measures how |
23 | * precise the timers are. Expect values between 10 and 20 ms on | 23 | * precise the timers are. Expect values between 0.2 and 2 ms on |
24 | * modern machines. | 24 | * modern machines. |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_common.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_scheduler_lib.h" | ||
29 | #include "gnunet_time_lib.h" | ||
30 | 28 | ||
31 | static struct GNUNET_TIME_Absolute target; | 29 | static struct GNUNET_TIME_Absolute target; |
32 | 30 | ||
@@ -36,7 +34,8 @@ static unsigned long long cumDelta; | |||
36 | 34 | ||
37 | #define INCR 47 | 35 | #define INCR 47 |
38 | 36 | ||
39 | #define MAXV 1500 | 37 | #define MAXV 5000 |
38 | |||
40 | 39 | ||
41 | /** | 40 | /** |
42 | * Signature of the main function of a task. | 41 | * Signature of the main function of a task. |
@@ -45,18 +44,19 @@ static unsigned long long cumDelta; | |||
45 | * @param tc context | 44 | * @param tc context |
46 | */ | 45 | */ |
47 | static void | 46 | static void |
48 | test_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 47 | test_task (void *cls, |
48 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
49 | { | 49 | { |
50 | struct GNUNET_TIME_Absolute now; | 50 | struct GNUNET_TIME_Absolute now; |
51 | 51 | ||
52 | now = GNUNET_TIME_absolute_get (); | 52 | now = GNUNET_TIME_absolute_get (); |
53 | if (now.abs_value > target.abs_value) | 53 | if (now.abs_value_us > target.abs_value_us) |
54 | cumDelta += (now.abs_value - target.abs_value); | 54 | cumDelta += (now.abs_value_us - target.abs_value_us); |
55 | else | 55 | else |
56 | cumDelta += (target.abs_value - now.abs_value); | 56 | cumDelta += (target.abs_value_us - now.abs_value_us); |
57 | target = | 57 | target = |
58 | GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply | 58 | GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply |
59 | (GNUNET_TIME_UNIT_MILLISECONDS, i)); | 59 | (GNUNET_TIME_UNIT_MICROSECONDS, i)); |
60 | FPRINTF (stderr, "%s", "."); | 60 | FPRINTF (stderr, "%s", "."); |
61 | if (i > MAXV) | 61 | if (i > MAXV) |
62 | { | 62 | { |
@@ -64,7 +64,7 @@ test_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
64 | return; | 64 | return; |
65 | } | 65 | } |
66 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 66 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
67 | (GNUNET_TIME_UNIT_MILLISECONDS, i), &test_task, | 67 | (GNUNET_TIME_UNIT_MICROSECONDS, i), &test_task, |
68 | NULL); | 68 | NULL); |
69 | i += INCR; | 69 | i += INCR; |
70 | } | 70 | } |
@@ -76,13 +76,14 @@ main (int argc, char *argv[]) | |||
76 | GNUNET_log_setup ("test-scheduler-delay", "WARNING", NULL); | 76 | GNUNET_log_setup ("test-scheduler-delay", "WARNING", NULL); |
77 | target = GNUNET_TIME_absolute_get (); | 77 | target = GNUNET_TIME_absolute_get (); |
78 | GNUNET_SCHEDULER_run (&test_task, NULL); | 78 | GNUNET_SCHEDULER_run (&test_task, NULL); |
79 | FPRINTF (stdout, "Sleep precision: %llu ms. ", | 79 | FPRINTF (stdout, |
80 | cumDelta / 1000 / (MAXV / INCR)); | 80 | "Sleep precision: %llu microseconds (average delta). ", |
81 | if (cumDelta <= 10 * MAXV / INCR) | 81 | cumDelta / (MAXV / INCR)); |
82 | if (cumDelta <= 500 * MAXV / INCR) | ||
82 | FPRINTF (stdout, "%s", "Timer precision is excellent.\n"); | 83 | FPRINTF (stdout, "%s", "Timer precision is excellent.\n"); |
83 | else if (cumDelta <= 50 * MAXV / INCR) /* 50 ms average deviation */ | 84 | else if (cumDelta <= 5000 * MAXV / INCR) /* 5 ms average deviation */ |
84 | FPRINTF (stdout, "%s", "Timer precision is good.\n"); | 85 | FPRINTF (stdout, "%s", "Timer precision is good.\n"); |
85 | else if (cumDelta > 250 * MAXV / INCR) | 86 | else if (cumDelta > 25000 * MAXV / INCR) |
86 | FPRINTF (stdout, "%s", "Timer precision is awful.\n"); | 87 | FPRINTF (stdout, "%s", "Timer precision is awful.\n"); |
87 | else | 88 | else |
88 | FPRINTF (stdout, "%s", "Timer precision is acceptable.\n"); | 89 | FPRINTF (stdout, "%s", "Timer precision is acceptable.\n"); |
diff --git a/src/util/test_speedup.c b/src/util/test_speedup.c index 03cffbd54..a2e6bb29c 100644 --- a/src/util/test_speedup.c +++ b/src/util/test_speedup.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2003, 2004, 2006, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2011-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -22,10 +22,7 @@ | |||
22 | * @brief testcase for speedup.c | 22 | * @brief testcase for speedup.c |
23 | */ | 23 | */ |
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_common.h" | 25 | #include "gnunet_util_lib.h" |
26 | #include "gnunet_program_lib.h" | ||
27 | #include "gnunet_time_lib.h" | ||
28 | #include "gnunet_strings_lib.h" | ||
29 | 26 | ||
30 | /** | 27 | /** |
31 | * Start time of the testcase | 28 | * Start time of the testcase |
@@ -100,19 +97,23 @@ main (int argc, char *argv[]) | |||
100 | "nohelp", options, &check, NULL); | 97 | "nohelp", options, &check, NULL); |
101 | 98 | ||
102 | end_real = time (NULL); | 99 | end_real = time (NULL); |
103 | delta = GNUNET_TIME_absolute_get_difference(start, end); | 100 | delta = GNUNET_TIME_absolute_get_difference (start, end); |
104 | 101 | ||
105 | if (delta.rel_value > ((end_real - start_real) * 1500LL)) | 102 | if (delta.rel_value_us > ((end_real - start_real) * 1500LL * 1000LL)) |
106 | { | 103 | { |
107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Execution time in GNUnet time: %llu ms\n", | 104 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
108 | (unsigned long long) delta.rel_value); | 105 | "Execution time in GNUnet time: %s\n", |
109 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Execution time in system time: %llu ms\n", | 106 | GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES)); |
107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
108 | "Execution time in system time: %llu ms\n", | ||
110 | (unsigned long long) ((end_real - start_real) * 1000LL)); | 109 | (unsigned long long) ((end_real - start_real) * 1000LL)); |
111 | return 0; | 110 | return 0; |
112 | } | 111 | } |
113 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Execution time in GNUnet time: %llu ms\n", | 112 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
114 | (unsigned long long) delta.rel_value); | 113 | "Execution time in GNUnet time: %s\n", |
115 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Execution time in system time: %llu ms\n", | 114 | GNUNET_STRINGS_relative_time_to_string (delta, GNUNET_YES)); |
115 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
116 | "Execution time in system time: %llu ms\n", | ||
116 | (unsigned long long) ((end_real - start_real) * 1000LL)); | 117 | (unsigned long long) ((end_real - start_real) * 1000LL)); |
117 | return 1; | 118 | return 1; |
118 | } | 119 | } |
diff --git a/src/util/test_strings.c b/src/util/test_strings.c index e5247ad91..e0c3cfebf 100644 --- a/src/util/test_strings.c +++ b/src/util/test_strings.c | |||
@@ -87,7 +87,7 @@ main (int argc, char *argv[]) | |||
87 | WANT ("btx", b); | 87 | WANT ("btx", b); |
88 | if (0 != GNUNET_STRINGS_buffer_tokenize (buf, 2, 2, &r, &b)) | 88 | if (0 != GNUNET_STRINGS_buffer_tokenize (buf, 2, 2, &r, &b)) |
89 | return 1; | 89 | return 1; |
90 | at.abs_value = 5000; | 90 | at.abs_value_us = 5000000; |
91 | bc = GNUNET_STRINGS_absolute_time_to_string (at); | 91 | bc = GNUNET_STRINGS_absolute_time_to_string (at); |
92 | /* bc should be something like "Wed Dec 31 17:00:05 1969" | 92 | /* bc should be something like "Wed Dec 31 17:00:05 1969" |
93 | * where the details of the day and hour depend on the timezone; | 93 | * where the details of the day and hour depend on the timezone; |
@@ -105,7 +105,7 @@ main (int argc, char *argv[]) | |||
105 | bc = GNUNET_STRINGS_absolute_time_to_string (at); | 105 | bc = GNUNET_STRINGS_absolute_time_to_string (at); |
106 | GNUNET_assert (GNUNET_OK == | 106 | GNUNET_assert (GNUNET_OK == |
107 | GNUNET_STRINGS_fancy_time_to_absolute (bc, &atx)); | 107 | GNUNET_STRINGS_fancy_time_to_absolute (bc, &atx)); |
108 | GNUNET_assert (atx.abs_value == at.abs_value); | 108 | GNUNET_assert (atx.abs_value_us == at.abs_value_us); |
109 | 109 | ||
110 | GNUNET_log_skip (2, GNUNET_NO); | 110 | GNUNET_log_skip (2, GNUNET_NO); |
111 | b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "unknown"); | 111 | b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "unknown"); |
@@ -116,7 +116,7 @@ main (int argc, char *argv[]) | |||
116 | GNUNET_STRINGS_fancy_time_to_relative ("15m", &rt)); | 116 | GNUNET_STRINGS_fancy_time_to_relative ("15m", &rt)); |
117 | GNUNET_assert (GNUNET_OK == | 117 | GNUNET_assert (GNUNET_OK == |
118 | GNUNET_STRINGS_fancy_time_to_relative ("15 m", &rtx)); | 118 | GNUNET_STRINGS_fancy_time_to_relative ("15 m", &rtx)); |
119 | GNUNET_assert (rt.rel_value == rtx.rel_value); | 119 | GNUNET_assert (rt.rel_value_us == rtx.rel_value_us); |
120 | 120 | ||
121 | return 0; | 121 | return 0; |
122 | } | 122 | } |
diff --git a/src/util/test_time.c b/src/util/test_time.c index cd1175416..467336e0a 100644 --- a/src/util/test_time.c +++ b/src/util/test_time.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2003, 2004, 2006, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2001-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -22,8 +22,7 @@ | |||
22 | * @brief testcase for time.c | 22 | * @brief testcase for time.c |
23 | */ | 23 | */ |
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_common.h" | 25 | #include "gnunet_util_lib.h" |
26 | #include "gnunet_time_lib.h" | ||
27 | 26 | ||
28 | 27 | ||
29 | int | 28 | int |
@@ -46,186 +45,186 @@ main (int argc, char *argv[]) | |||
46 | forever = GNUNET_TIME_UNIT_FOREVER_ABS; | 45 | forever = GNUNET_TIME_UNIT_FOREVER_ABS; |
47 | relForever = GNUNET_TIME_UNIT_FOREVER_REL; | 46 | relForever = GNUNET_TIME_UNIT_FOREVER_REL; |
48 | relUnit = GNUNET_TIME_UNIT_MILLISECONDS; | 47 | relUnit = GNUNET_TIME_UNIT_MILLISECONDS; |
49 | zero.abs_value = 0; | 48 | zero.abs_value_us = 0; |
50 | 49 | ||
51 | last = now = GNUNET_TIME_absolute_get (); | 50 | last = now = GNUNET_TIME_absolute_get (); |
52 | while (now.abs_value == last.abs_value) | 51 | while (now.abs_value_us == last.abs_value_us) |
53 | now = GNUNET_TIME_absolute_get (); | 52 | now = GNUNET_TIME_absolute_get (); |
54 | GNUNET_assert (now.abs_value > last.abs_value); | 53 | GNUNET_assert (now.abs_value_us > last.abs_value_us); |
55 | 54 | ||
56 | /* test overflow checking in multiply */ | 55 | /* test overflow checking in multiply */ |
57 | rel = GNUNET_TIME_UNIT_SECONDS; | 56 | rel = GNUNET_TIME_UNIT_MILLISECONDS; |
58 | GNUNET_log_skip (1, GNUNET_NO); | 57 | GNUNET_log_skip (1, GNUNET_NO); |
59 | for (i = 0; i < 55; i++) | 58 | for (i = 0; i < 55; i++) |
60 | rel = GNUNET_TIME_relative_multiply (rel, 2); | 59 | rel = GNUNET_TIME_relative_multiply (rel, 2); |
61 | GNUNET_log_skip (0, GNUNET_NO); | 60 | GNUNET_log_skip (0, GNUNET_NO); |
62 | GNUNET_assert (rel.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value); | 61 | GNUNET_assert (rel.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us); |
63 | /*check zero */ | 62 | /*check zero */ |
64 | rel.rel_value = (UINT64_MAX) - 1024; | 63 | rel.rel_value_us = (UINT64_MAX) - 1024; |
65 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO.rel_value == | 64 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO.rel_value_us == |
66 | GNUNET_TIME_relative_multiply (rel, 0).rel_value); | 65 | GNUNET_TIME_relative_multiply (rel, 0).rel_value_us); |
67 | 66 | ||
68 | /* test infinity-check for relative to absolute */ | 67 | /* test infinity-check for relative to absolute */ |
69 | GNUNET_log_skip (1, GNUNET_NO); | 68 | GNUNET_log_skip (1, GNUNET_NO); |
70 | last = GNUNET_TIME_relative_to_absolute (rel); | 69 | last = GNUNET_TIME_relative_to_absolute (rel); |
71 | GNUNET_assert (last.abs_value == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value); | 70 | GNUNET_assert (last.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us); |
72 | GNUNET_log_skip (0, GNUNET_YES); | 71 | GNUNET_log_skip (0, GNUNET_YES); |
73 | 72 | ||
74 | /*check relative to absolute */ | 73 | /*check relative to absolute */ |
75 | rel.rel_value = 0; | 74 | rel.rel_value_us = 0; |
76 | GNUNET_assert (GNUNET_TIME_absolute_get ().abs_value == | 75 | GNUNET_assert (GNUNET_TIME_absolute_get ().abs_value_us == |
77 | GNUNET_TIME_relative_to_absolute (rel).abs_value); | 76 | GNUNET_TIME_relative_to_absolute (rel).abs_value_us); |
78 | /*check forever */ | 77 | /*check forever */ |
79 | rel.rel_value = UINT64_MAX; | 78 | rel.rel_value_us = UINT64_MAX; |
80 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value == | 79 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us == |
81 | GNUNET_TIME_relative_to_absolute (rel).abs_value); | 80 | GNUNET_TIME_relative_to_absolute (rel).abs_value_us); |
82 | /* check overflow for r2a */ | 81 | /* check overflow for r2a */ |
83 | rel.rel_value = (UINT64_MAX) - 1024; | 82 | rel.rel_value_us = (UINT64_MAX) - 1024; |
84 | GNUNET_log_skip (1, GNUNET_NO); | 83 | GNUNET_log_skip (1, GNUNET_NO); |
85 | last = GNUNET_TIME_relative_to_absolute (rel); | 84 | last = GNUNET_TIME_relative_to_absolute (rel); |
86 | GNUNET_log_skip (0, GNUNET_NO); | 85 | GNUNET_log_skip (0, GNUNET_NO); |
87 | GNUNET_assert (last.abs_value == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value); | 86 | GNUNET_assert (last.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us); |
88 | 87 | ||
89 | /* check overflow for relative add */ | 88 | /* check overflow for relative add */ |
90 | GNUNET_log_skip (1, GNUNET_NO); | 89 | GNUNET_log_skip (1, GNUNET_NO); |
91 | rel = GNUNET_TIME_relative_add (rel, rel); | 90 | rel = GNUNET_TIME_relative_add (rel, rel); |
92 | GNUNET_log_skip (0, GNUNET_NO); | 91 | GNUNET_log_skip (0, GNUNET_NO); |
93 | GNUNET_assert (rel.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value); | 92 | GNUNET_assert (rel.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us); |
94 | 93 | ||
95 | GNUNET_log_skip (1, GNUNET_NO); | 94 | GNUNET_log_skip (1, GNUNET_NO); |
96 | rel = GNUNET_TIME_relative_add (relForever, relForever); | 95 | rel = GNUNET_TIME_relative_add (relForever, relForever); |
97 | GNUNET_log_skip (0, GNUNET_NO); | 96 | GNUNET_log_skip (0, GNUNET_NO); |
98 | GNUNET_assert (rel.rel_value == relForever.rel_value); | 97 | GNUNET_assert (rel.rel_value_us == relForever.rel_value_us); |
99 | 98 | ||
100 | GNUNET_log_skip (1, GNUNET_NO); | 99 | GNUNET_log_skip (1, GNUNET_NO); |
101 | rel = GNUNET_TIME_relative_add (relUnit, relUnit); | 100 | rel = GNUNET_TIME_relative_add (relUnit, relUnit); |
102 | GNUNET_assert (rel.rel_value == 2 * relUnit.rel_value); | 101 | GNUNET_assert (rel.rel_value_us == 2 * relUnit.rel_value_us); |
103 | 102 | ||
104 | /* check relation check in get_duration */ | 103 | /* check relation check in get_duration */ |
105 | future.abs_value = now.abs_value + 1000000; | 104 | future.abs_value_us = now.abs_value_us + 1000000; |
106 | GNUNET_assert (GNUNET_TIME_absolute_get_difference (now, future).rel_value == | 105 | GNUNET_assert (GNUNET_TIME_absolute_get_difference (now, future).rel_value_us == |
107 | 1000000); | 106 | 1000000); |
108 | GNUNET_assert (GNUNET_TIME_absolute_get_difference (future, now).rel_value == | 107 | GNUNET_assert (GNUNET_TIME_absolute_get_difference (future, now).rel_value_us == |
109 | 0); | 108 | 0); |
110 | 109 | ||
111 | GNUNET_assert (GNUNET_TIME_absolute_get_difference (zero, forever).rel_value | 110 | GNUNET_assert (GNUNET_TIME_absolute_get_difference (zero, forever).rel_value_us |
112 | == forever.abs_value); | 111 | == forever.abs_value_us); |
113 | 112 | ||
114 | past.abs_value = now.abs_value - 1000000; | 113 | past.abs_value_us = now.abs_value_us - 1000000; |
115 | rel = GNUNET_TIME_absolute_get_duration (future); | 114 | rel = GNUNET_TIME_absolute_get_duration (future); |
116 | GNUNET_assert (rel.rel_value == 0); | 115 | GNUNET_assert (rel.rel_value_us == 0); |
117 | rel = GNUNET_TIME_absolute_get_duration (past); | 116 | rel = GNUNET_TIME_absolute_get_duration (past); |
118 | GNUNET_assert (rel.rel_value >= 1000000); | 117 | GNUNET_assert (rel.rel_value_us >= 1000000); |
119 | 118 | ||
120 | /* check get remaining */ | 119 | /* check get remaining */ |
121 | rel = GNUNET_TIME_absolute_get_remaining (now); | 120 | rel = GNUNET_TIME_absolute_get_remaining (now); |
122 | GNUNET_assert (rel.rel_value == 0); | 121 | GNUNET_assert (rel.rel_value_us == 0); |
123 | rel = GNUNET_TIME_absolute_get_remaining (past); | 122 | rel = GNUNET_TIME_absolute_get_remaining (past); |
124 | GNUNET_assert (rel.rel_value == 0); | 123 | GNUNET_assert (rel.rel_value_us == 0); |
125 | rel = GNUNET_TIME_absolute_get_remaining (future); | 124 | rel = GNUNET_TIME_absolute_get_remaining (future); |
126 | GNUNET_assert (rel.rel_value > 0); | 125 | GNUNET_assert (rel.rel_value_us > 0); |
127 | GNUNET_assert (rel.rel_value <= 1000000); | 126 | GNUNET_assert (rel.rel_value_us <= 1000000); |
128 | forever = GNUNET_TIME_UNIT_FOREVER_ABS; | 127 | forever = GNUNET_TIME_UNIT_FOREVER_ABS; |
129 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value == | 128 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == |
130 | GNUNET_TIME_absolute_get_remaining (forever).rel_value); | 129 | GNUNET_TIME_absolute_get_remaining (forever).rel_value_us); |
131 | 130 | ||
132 | /* check endianess */ | 131 | /* check endianess */ |
133 | reln = GNUNET_TIME_relative_hton (rel); | 132 | reln = GNUNET_TIME_relative_hton (rel); |
134 | GNUNET_assert (rel.rel_value == GNUNET_TIME_relative_ntoh (reln).rel_value); | 133 | GNUNET_assert (rel.rel_value_us == GNUNET_TIME_relative_ntoh (reln).rel_value_us); |
135 | nown = GNUNET_TIME_absolute_hton (now); | 134 | nown = GNUNET_TIME_absolute_hton (now); |
136 | GNUNET_assert (now.abs_value == GNUNET_TIME_absolute_ntoh (nown).abs_value); | 135 | GNUNET_assert (now.abs_value_us == GNUNET_TIME_absolute_ntoh (nown).abs_value_us); |
137 | 136 | ||
138 | /* check absolute addition */ | 137 | /* check absolute addition */ |
139 | future = GNUNET_TIME_absolute_add (now, GNUNET_TIME_UNIT_SECONDS); | 138 | future = GNUNET_TIME_absolute_add (now, GNUNET_TIME_UNIT_SECONDS); |
140 | GNUNET_assert (future.abs_value == now.abs_value + 1000); | 139 | GNUNET_assert (future.abs_value_us == now.abs_value_us + 1000 * 1000LL); |
141 | 140 | ||
142 | future = GNUNET_TIME_absolute_add (forever, GNUNET_TIME_UNIT_ZERO); | 141 | future = GNUNET_TIME_absolute_add (forever, GNUNET_TIME_UNIT_ZERO); |
143 | GNUNET_assert (future.abs_value == forever.abs_value); | 142 | GNUNET_assert (future.abs_value_us == forever.abs_value_us); |
144 | 143 | ||
145 | rel.rel_value = (UINT64_MAX) - 1024; | 144 | rel.rel_value_us = (UINT64_MAX) - 1024; |
146 | now.abs_value = rel.rel_value; | 145 | now.abs_value_us = rel.rel_value_us; |
147 | future = GNUNET_TIME_absolute_add (now, rel); | 146 | future = GNUNET_TIME_absolute_add (now, rel); |
148 | GNUNET_assert (future.abs_value == forever.abs_value); | 147 | GNUNET_assert (future.abs_value_us == forever.abs_value_us); |
149 | 148 | ||
150 | /* check zero */ | 149 | /* check zero */ |
151 | future = GNUNET_TIME_absolute_add (now, GNUNET_TIME_UNIT_ZERO); | 150 | future = GNUNET_TIME_absolute_add (now, GNUNET_TIME_UNIT_ZERO); |
152 | GNUNET_assert (future.abs_value == now.abs_value); | 151 | GNUNET_assert (future.abs_value_us == now.abs_value_us); |
153 | 152 | ||
154 | GNUNET_assert (forever.abs_value == | 153 | GNUNET_assert (forever.abs_value_us == |
155 | GNUNET_TIME_absolute_subtract (forever, | 154 | GNUNET_TIME_absolute_subtract (forever, |
156 | GNUNET_TIME_UNIT_MINUTES).abs_value); | 155 | GNUNET_TIME_UNIT_MINUTES).abs_value_us); |
157 | /*check absolute subtract */ | 156 | /*check absolute subtract */ |
158 | now.abs_value = 50000; | 157 | now.abs_value_us = 50000; |
159 | rel.rel_value = 100000; | 158 | rel.rel_value_us = 100000; |
160 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO_ABS.abs_value == | 159 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO_ABS.abs_value_us == |
161 | (GNUNET_TIME_absolute_subtract (now, rel)).abs_value); | 160 | (GNUNET_TIME_absolute_subtract (now, rel)).abs_value_us); |
162 | rel.rel_value = 10000; | 161 | rel.rel_value_us = 10000; |
163 | GNUNET_assert (40000 == (GNUNET_TIME_absolute_subtract (now, rel)).abs_value); | 162 | GNUNET_assert (40000 == (GNUNET_TIME_absolute_subtract (now, rel)).abs_value_us); |
164 | 163 | ||
165 | /*check relative divide */ | 164 | /*check relative divide */ |
166 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value == | 165 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == |
167 | (GNUNET_TIME_relative_divide (rel, 0)).rel_value); | 166 | (GNUNET_TIME_relative_divide (rel, 0)).rel_value_us); |
168 | 167 | ||
169 | rel = GNUNET_TIME_UNIT_FOREVER_REL; | 168 | rel = GNUNET_TIME_UNIT_FOREVER_REL; |
170 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value == | 169 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == |
171 | (GNUNET_TIME_relative_divide (rel, 2)).rel_value); | 170 | (GNUNET_TIME_relative_divide (rel, 2)).rel_value_us); |
172 | 171 | ||
173 | rel = GNUNET_TIME_relative_divide (relUnit, 2); | 172 | rel = GNUNET_TIME_relative_divide (relUnit, 2); |
174 | GNUNET_assert (rel.rel_value == relUnit.rel_value / 2); | 173 | GNUNET_assert (rel.rel_value_us == relUnit.rel_value_us / 2); |
175 | 174 | ||
176 | 175 | ||
177 | /* check Return absolute time of 0ms */ | 176 | /* check Return absolute time of 0ms */ |
178 | zero = GNUNET_TIME_UNIT_ZERO_ABS; | 177 | zero = GNUNET_TIME_UNIT_ZERO_ABS; |
179 | 178 | ||
180 | /* check GNUNET_TIME_calculate_eta */ | 179 | /* check GNUNET_TIME_calculate_eta */ |
181 | last.abs_value = GNUNET_TIME_absolute_get ().abs_value - 1024; | 180 | last.abs_value_us = GNUNET_TIME_absolute_get ().abs_value_us - 1024; |
182 | forever = GNUNET_TIME_UNIT_FOREVER_ABS; | 181 | forever = GNUNET_TIME_UNIT_FOREVER_ABS; |
183 | forever.abs_value = forever.abs_value - 1024; | 182 | forever.abs_value_us = forever.abs_value_us - 1024; |
184 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO_ABS.abs_value == | 183 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO_ABS.abs_value_us == |
185 | GNUNET_TIME_calculate_eta (forever, 50000, 100000).rel_value); | 184 | GNUNET_TIME_calculate_eta (forever, 50000, 100000).rel_value_us); |
186 | /* check zero */ | 185 | /* check zero */ |
187 | GNUNET_log_skip (1, GNUNET_NO); | 186 | GNUNET_log_skip (1, GNUNET_NO); |
188 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO.rel_value == | 187 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO.rel_value_us == |
189 | (GNUNET_TIME_calculate_eta (last, 60000, 50000)).rel_value); | 188 | (GNUNET_TIME_calculate_eta (last, 60000, 50000)).rel_value_us); |
190 | GNUNET_log_skip (0, GNUNET_YES); | 189 | GNUNET_log_skip (0, GNUNET_YES); |
191 | /*check forever */ | 190 | /*check forever */ |
192 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value == | 191 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == |
193 | (GNUNET_TIME_calculate_eta (last, 0, 50000)).rel_value); | 192 | (GNUNET_TIME_calculate_eta (last, 0, 50000)).rel_value_us); |
194 | 193 | ||
195 | /*check relative subtract */ | 194 | /*check relative subtract */ |
196 | now = GNUNET_TIME_absolute_get (); | 195 | now = GNUNET_TIME_absolute_get (); |
197 | rel.rel_value = now.abs_value; | 196 | rel.rel_value_us = now.abs_value_us; |
198 | relForever.rel_value = rel.rel_value + 1024; | 197 | relForever.rel_value_us = rel.rel_value_us + 1024; |
199 | GNUNET_assert (1024 == | 198 | GNUNET_assert (1024 == |
200 | GNUNET_TIME_relative_subtract (relForever, rel).rel_value); | 199 | GNUNET_TIME_relative_subtract (relForever, rel).rel_value_us); |
201 | /*check zero */ | 200 | /*check zero */ |
202 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO.rel_value == | 201 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO.rel_value_us == |
203 | GNUNET_TIME_relative_subtract (rel, relForever).rel_value); | 202 | GNUNET_TIME_relative_subtract (rel, relForever).rel_value_us); |
204 | /*check forever */ | 203 | /*check forever */ |
205 | rel.rel_value = UINT64_MAX; | 204 | rel.rel_value_us = UINT64_MAX; |
206 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value == | 205 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == |
207 | GNUNET_TIME_relative_subtract (rel, relForever).rel_value); | 206 | GNUNET_TIME_relative_subtract (rel, relForever).rel_value_us); |
208 | 207 | ||
209 | /*check GNUNET_TIME_relative_min */ | 208 | /*check GNUNET_TIME_relative_min */ |
210 | now = GNUNET_TIME_absolute_get (); | 209 | now = GNUNET_TIME_absolute_get (); |
211 | rel.rel_value = now.abs_value; | 210 | rel.rel_value_us = now.abs_value_us; |
212 | relForever.rel_value = rel.rel_value - 1024; | 211 | relForever.rel_value_us = rel.rel_value_us - 1024; |
213 | GNUNET_assert (relForever.rel_value == | 212 | GNUNET_assert (relForever.rel_value_us == |
214 | GNUNET_TIME_relative_min (rel, relForever).rel_value); | 213 | GNUNET_TIME_relative_min (rel, relForever).rel_value_us); |
215 | 214 | ||
216 | /*check GNUNET_TIME_relative_max */ | 215 | /*check GNUNET_TIME_relative_max */ |
217 | GNUNET_assert (rel.rel_value == | 216 | GNUNET_assert (rel.rel_value_us == |
218 | GNUNET_TIME_relative_max (rel, relForever).rel_value); | 217 | GNUNET_TIME_relative_max (rel, relForever).rel_value_us); |
219 | 218 | ||
220 | /*check GNUNET_TIME_absolute_min */ | 219 | /*check GNUNET_TIME_absolute_min */ |
221 | now = GNUNET_TIME_absolute_get (); | 220 | now = GNUNET_TIME_absolute_get (); |
222 | last.abs_value = now.abs_value - 1024; | 221 | last.abs_value_us = now.abs_value_us - 1024; |
223 | GNUNET_assert (last.abs_value == | 222 | GNUNET_assert (last.abs_value_us == |
224 | GNUNET_TIME_absolute_min (now, last).abs_value); | 223 | GNUNET_TIME_absolute_min (now, last).abs_value_us); |
225 | 224 | ||
226 | /*check GNUNET_TIME_absolute_max */ | 225 | /*check GNUNET_TIME_absolute_max */ |
227 | GNUNET_assert (now.abs_value == | 226 | GNUNET_assert (now.abs_value_us == |
228 | GNUNET_TIME_absolute_max (now, last).abs_value); | 227 | GNUNET_TIME_absolute_max (now, last).abs_value_us); |
229 | 228 | ||
230 | return 0; | 229 | return 0; |
231 | } | 230 | } |
diff --git a/src/util/time.c b/src/util/time.c index 825b7f8ca..5e9a01b09 100644 --- a/src/util/time.c +++ b/src/util/time.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2006, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2001-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -70,9 +70,9 @@ GNUNET_TIME_absolute_get () | |||
70 | struct timeval tv; | 70 | struct timeval tv; |
71 | 71 | ||
72 | GETTIMEOFDAY (&tv, NULL); | 72 | GETTIMEOFDAY (&tv, NULL); |
73 | ret.abs_value = | 73 | ret.abs_value_us = |
74 | (uint64_t) (((uint64_t) tv.tv_sec * 1000LL) + | 74 | (uint64_t) (((uint64_t) tv.tv_sec * 1000LL * 1000LL) + |
75 | ((uint64_t) tv.tv_usec / 1000LL)) + timestamp_offset; | 75 | ((uint64_t) tv.tv_usec)) + timestamp_offset; |
76 | return ret; | 76 | return ret; |
77 | } | 77 | } |
78 | 78 | ||
@@ -102,7 +102,7 @@ GNUNET_TIME_absolute_get_zero_ () | |||
102 | 102 | ||
103 | 103 | ||
104 | /** | 104 | /** |
105 | * Return relative time of 1ms. | 105 | * Return relative time of 1us. |
106 | */ | 106 | */ |
107 | struct GNUNET_TIME_Relative | 107 | struct GNUNET_TIME_Relative |
108 | GNUNET_TIME_relative_get_unit_ () | 108 | GNUNET_TIME_relative_get_unit_ () |
@@ -113,12 +113,23 @@ GNUNET_TIME_relative_get_unit_ () | |||
113 | 113 | ||
114 | 114 | ||
115 | /** | 115 | /** |
116 | * Return relative time of 1ms. | ||
117 | */ | ||
118 | struct GNUNET_TIME_Relative | ||
119 | GNUNET_TIME_relative_get_millisecond_ () | ||
120 | { | ||
121 | static struct GNUNET_TIME_Relative one = { 1000 }; | ||
122 | return one; | ||
123 | } | ||
124 | |||
125 | |||
126 | /** | ||
116 | * Return relative time of 1s. | 127 | * Return relative time of 1s. |
117 | */ | 128 | */ |
118 | struct GNUNET_TIME_Relative | 129 | struct GNUNET_TIME_Relative |
119 | GNUNET_TIME_relative_get_second_ () | 130 | GNUNET_TIME_relative_get_second_ () |
120 | { | 131 | { |
121 | static struct GNUNET_TIME_Relative one = { 1000 }; | 132 | static struct GNUNET_TIME_Relative one = { 1000 * 1000LL }; |
122 | return one; | 133 | return one; |
123 | } | 134 | } |
124 | 135 | ||
@@ -129,7 +140,7 @@ GNUNET_TIME_relative_get_second_ () | |||
129 | struct GNUNET_TIME_Relative | 140 | struct GNUNET_TIME_Relative |
130 | GNUNET_TIME_relative_get_minute_ () | 141 | GNUNET_TIME_relative_get_minute_ () |
131 | { | 142 | { |
132 | static struct GNUNET_TIME_Relative one = { 60 * 1000 }; | 143 | static struct GNUNET_TIME_Relative one = { 60 * 1000 * 1000LL }; |
133 | return one; | 144 | return one; |
134 | } | 145 | } |
135 | 146 | ||
@@ -140,7 +151,7 @@ GNUNET_TIME_relative_get_minute_ () | |||
140 | struct GNUNET_TIME_Relative | 151 | struct GNUNET_TIME_Relative |
141 | GNUNET_TIME_relative_get_hour_ () | 152 | GNUNET_TIME_relative_get_hour_ () |
142 | { | 153 | { |
143 | static struct GNUNET_TIME_Relative one = { 60 * 60 * 1000 }; | 154 | static struct GNUNET_TIME_Relative one = { 60 * 60 * 1000 * 1000LL }; |
144 | return one; | 155 | return one; |
145 | } | 156 | } |
146 | 157 | ||
@@ -176,16 +187,16 @@ GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel) | |||
176 | { | 187 | { |
177 | struct GNUNET_TIME_Absolute ret; | 188 | struct GNUNET_TIME_Absolute ret; |
178 | 189 | ||
179 | if (rel.rel_value == UINT64_MAX) | 190 | if (rel.rel_value_us == UINT64_MAX) |
180 | return GNUNET_TIME_UNIT_FOREVER_ABS; | 191 | return GNUNET_TIME_UNIT_FOREVER_ABS; |
181 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); | 192 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); |
182 | 193 | ||
183 | if (rel.rel_value + now.abs_value < rel.rel_value) | 194 | if (rel.rel_value_us + now.abs_value_us < rel.rel_value_us) |
184 | { | 195 | { |
185 | GNUNET_break (0); /* overflow... */ | 196 | GNUNET_break (0); /* overflow... */ |
186 | return GNUNET_TIME_UNIT_FOREVER_ABS; | 197 | return GNUNET_TIME_UNIT_FOREVER_ABS; |
187 | } | 198 | } |
188 | ret.abs_value = rel.rel_value + now.abs_value; | 199 | ret.abs_value_us = rel.rel_value_us + now.abs_value_us; |
189 | return ret; | 200 | return ret; |
190 | } | 201 | } |
191 | 202 | ||
@@ -201,7 +212,7 @@ struct GNUNET_TIME_Relative | |||
201 | GNUNET_TIME_relative_min (struct GNUNET_TIME_Relative t1, | 212 | GNUNET_TIME_relative_min (struct GNUNET_TIME_Relative t1, |
202 | struct GNUNET_TIME_Relative t2) | 213 | struct GNUNET_TIME_Relative t2) |
203 | { | 214 | { |
204 | return (t1.rel_value < t2.rel_value) ? t1 : t2; | 215 | return (t1.rel_value_us < t2.rel_value_us) ? t1 : t2; |
205 | } | 216 | } |
206 | 217 | ||
207 | 218 | ||
@@ -216,7 +227,7 @@ struct GNUNET_TIME_Relative | |||
216 | GNUNET_TIME_relative_max (struct GNUNET_TIME_Relative t1, | 227 | GNUNET_TIME_relative_max (struct GNUNET_TIME_Relative t1, |
217 | struct GNUNET_TIME_Relative t2) | 228 | struct GNUNET_TIME_Relative t2) |
218 | { | 229 | { |
219 | return (t1.rel_value > t2.rel_value) ? t1 : t2; | 230 | return (t1.rel_value_us > t2.rel_value_us) ? t1 : t2; |
220 | } | 231 | } |
221 | 232 | ||
222 | 233 | ||
@@ -232,7 +243,7 @@ struct GNUNET_TIME_Absolute | |||
232 | GNUNET_TIME_absolute_min (struct GNUNET_TIME_Absolute t1, | 243 | GNUNET_TIME_absolute_min (struct GNUNET_TIME_Absolute t1, |
233 | struct GNUNET_TIME_Absolute t2) | 244 | struct GNUNET_TIME_Absolute t2) |
234 | { | 245 | { |
235 | return (t1.abs_value < t2.abs_value) ? t1 : t2; | 246 | return (t1.abs_value_us < t2.abs_value_us) ? t1 : t2; |
236 | } | 247 | } |
237 | 248 | ||
238 | 249 | ||
@@ -247,7 +258,7 @@ struct GNUNET_TIME_Absolute | |||
247 | GNUNET_TIME_absolute_max (struct GNUNET_TIME_Absolute t1, | 258 | GNUNET_TIME_absolute_max (struct GNUNET_TIME_Absolute t1, |
248 | struct GNUNET_TIME_Absolute t2) | 259 | struct GNUNET_TIME_Absolute t2) |
249 | { | 260 | { |
250 | return (t1.abs_value > t2.abs_value) ? t1 : t2; | 261 | return (t1.abs_value_us > t2.abs_value_us) ? t1 : t2; |
251 | } | 262 | } |
252 | 263 | ||
253 | 264 | ||
@@ -262,13 +273,13 @@ GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future) | |||
262 | { | 273 | { |
263 | struct GNUNET_TIME_Relative ret; | 274 | struct GNUNET_TIME_Relative ret; |
264 | 275 | ||
265 | if (future.abs_value == UINT64_MAX) | 276 | if (future.abs_value_us == UINT64_MAX) |
266 | return GNUNET_TIME_UNIT_FOREVER_REL; | 277 | return GNUNET_TIME_UNIT_FOREVER_REL; |
267 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); | 278 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); |
268 | 279 | ||
269 | if (now.abs_value > future.abs_value) | 280 | if (now.abs_value_us > future.abs_value_us) |
270 | return GNUNET_TIME_UNIT_ZERO; | 281 | return GNUNET_TIME_UNIT_ZERO; |
271 | ret.rel_value = future.abs_value - now.abs_value; | 282 | ret.rel_value_us = future.abs_value_us - now.abs_value_us; |
272 | return ret; | 283 | return ret; |
273 | } | 284 | } |
274 | 285 | ||
@@ -285,11 +296,11 @@ GNUNET_TIME_absolute_get_difference (struct GNUNET_TIME_Absolute start, | |||
285 | { | 296 | { |
286 | struct GNUNET_TIME_Relative ret; | 297 | struct GNUNET_TIME_Relative ret; |
287 | 298 | ||
288 | if (end.abs_value == UINT64_MAX) | 299 | if (end.abs_value_us == UINT64_MAX) |
289 | return GNUNET_TIME_UNIT_FOREVER_REL; | 300 | return GNUNET_TIME_UNIT_FOREVER_REL; |
290 | if (end.abs_value < start.abs_value) | 301 | if (end.abs_value_us < start.abs_value_us) |
291 | return GNUNET_TIME_UNIT_ZERO; | 302 | return GNUNET_TIME_UNIT_ZERO; |
292 | ret.rel_value = end.abs_value - start.abs_value; | 303 | ret.rel_value_us = end.abs_value_us - start.abs_value_us; |
293 | return ret; | 304 | return ret; |
294 | } | 305 | } |
295 | 306 | ||
@@ -306,10 +317,10 @@ GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence) | |||
306 | struct GNUNET_TIME_Relative ret; | 317 | struct GNUNET_TIME_Relative ret; |
307 | 318 | ||
308 | now = GNUNET_TIME_absolute_get (); | 319 | now = GNUNET_TIME_absolute_get (); |
309 | GNUNET_assert (whence.abs_value != UINT64_MAX); | 320 | GNUNET_assert (whence.abs_value_us != UINT64_MAX); |
310 | if (whence.abs_value > now.abs_value) | 321 | if (whence.abs_value_us > now.abs_value_us) |
311 | return GNUNET_TIME_UNIT_ZERO; | 322 | return GNUNET_TIME_UNIT_ZERO; |
312 | ret.rel_value = now.abs_value - whence.abs_value; | 323 | ret.rel_value_us = now.abs_value_us - whence.abs_value_us; |
313 | return ret; | 324 | return ret; |
314 | } | 325 | } |
315 | 326 | ||
@@ -326,14 +337,14 @@ GNUNET_TIME_absolute_add (struct GNUNET_TIME_Absolute start, | |||
326 | { | 337 | { |
327 | struct GNUNET_TIME_Absolute ret; | 338 | struct GNUNET_TIME_Absolute ret; |
328 | 339 | ||
329 | if ((start.abs_value == UINT64_MAX) || (duration.rel_value == UINT64_MAX)) | 340 | if ((start.abs_value_us == UINT64_MAX) || (duration.rel_value_us == UINT64_MAX)) |
330 | return GNUNET_TIME_UNIT_FOREVER_ABS; | 341 | return GNUNET_TIME_UNIT_FOREVER_ABS; |
331 | if (start.abs_value + duration.rel_value < start.abs_value) | 342 | if (start.abs_value_us + duration.rel_value_us < start.abs_value_us) |
332 | { | 343 | { |
333 | GNUNET_break (0); | 344 | GNUNET_break (0); |
334 | return GNUNET_TIME_UNIT_FOREVER_ABS; | 345 | return GNUNET_TIME_UNIT_FOREVER_ABS; |
335 | } | 346 | } |
336 | ret.abs_value = start.abs_value + duration.rel_value; | 347 | ret.abs_value_us = start.abs_value_us + duration.rel_value_us; |
337 | return ret; | 348 | return ret; |
338 | } | 349 | } |
339 | 350 | ||
@@ -352,11 +363,11 @@ GNUNET_TIME_absolute_subtract (struct GNUNET_TIME_Absolute start, | |||
352 | { | 363 | { |
353 | struct GNUNET_TIME_Absolute ret; | 364 | struct GNUNET_TIME_Absolute ret; |
354 | 365 | ||
355 | if (start.abs_value <= duration.rel_value) | 366 | if (start.abs_value_us <= duration.rel_value_us) |
356 | return GNUNET_TIME_UNIT_ZERO_ABS; | 367 | return GNUNET_TIME_UNIT_ZERO_ABS; |
357 | if (start.abs_value == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value) | 368 | if (start.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us) |
358 | return GNUNET_TIME_UNIT_FOREVER_ABS; | 369 | return GNUNET_TIME_UNIT_FOREVER_ABS; |
359 | ret.abs_value = start.abs_value - duration.rel_value; | 370 | ret.abs_value_us = start.abs_value_us - duration.rel_value_us; |
360 | return ret; | 371 | return ret; |
361 | } | 372 | } |
362 | 373 | ||
@@ -372,10 +383,10 @@ GNUNET_TIME_relative_multiply (struct GNUNET_TIME_Relative rel, | |||
372 | { | 383 | { |
373 | struct GNUNET_TIME_Relative ret; | 384 | struct GNUNET_TIME_Relative ret; |
374 | 385 | ||
375 | if (factor == 0) | 386 | if (0 == factor) |
376 | return GNUNET_TIME_UNIT_ZERO; | 387 | return GNUNET_TIME_UNIT_ZERO; |
377 | ret.rel_value = rel.rel_value * (unsigned long long) factor; | 388 | ret.rel_value_us = rel.rel_value_us * (unsigned long long) factor; |
378 | if (ret.rel_value / factor != rel.rel_value) | 389 | if (ret.rel_value_us / factor != rel.rel_value_us) |
379 | { | 390 | { |
380 | GNUNET_break (0); | 391 | GNUNET_break (0); |
381 | return GNUNET_TIME_UNIT_FOREVER_REL; | 392 | return GNUNET_TIME_UNIT_FOREVER_REL; |
@@ -397,10 +408,10 @@ GNUNET_TIME_relative_divide (struct GNUNET_TIME_Relative rel, | |||
397 | { | 408 | { |
398 | struct GNUNET_TIME_Relative ret; | 409 | struct GNUNET_TIME_Relative ret; |
399 | 410 | ||
400 | if ((factor == 0) || | 411 | if ((0 == factor) || |
401 | (rel.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value)) | 412 | (rel.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)) |
402 | return GNUNET_TIME_UNIT_FOREVER_REL; | 413 | return GNUNET_TIME_UNIT_FOREVER_REL; |
403 | ret.rel_value = rel.rel_value / (unsigned long long) factor; | 414 | ret.rel_value_us = rel.rel_value_us / (unsigned long long) factor; |
404 | return ret; | 415 | return ret; |
405 | } | 416 | } |
406 | 417 | ||
@@ -426,11 +437,11 @@ GNUNET_TIME_calculate_eta (struct GNUNET_TIME_Absolute start, uint64_t finished, | |||
426 | GNUNET_break (finished <= total); | 437 | GNUNET_break (finished <= total); |
427 | if (finished >= total) | 438 | if (finished >= total) |
428 | return GNUNET_TIME_UNIT_ZERO; | 439 | return GNUNET_TIME_UNIT_ZERO; |
429 | if (finished == 0) | 440 | if (0 == finished) |
430 | return GNUNET_TIME_UNIT_FOREVER_REL; | 441 | return GNUNET_TIME_UNIT_FOREVER_REL; |
431 | dur = GNUNET_TIME_absolute_get_duration (start); | 442 | dur = GNUNET_TIME_absolute_get_duration (start); |
432 | exp = ((double) dur.rel_value) * ((double) total) / ((double) finished); | 443 | exp = ((double) dur.rel_value_us) * ((double) total) / ((double) finished); |
433 | ret.rel_value = ((uint64_t) exp) - dur.rel_value; | 444 | ret.rel_value_us = ((uint64_t) exp) - dur.rel_value_us; |
434 | return ret; | 445 | return ret; |
435 | } | 446 | } |
436 | 447 | ||
@@ -448,14 +459,14 @@ GNUNET_TIME_relative_add (struct GNUNET_TIME_Relative a1, | |||
448 | { | 459 | { |
449 | struct GNUNET_TIME_Relative ret; | 460 | struct GNUNET_TIME_Relative ret; |
450 | 461 | ||
451 | if ((a1.rel_value == UINT64_MAX) || (a2.rel_value == UINT64_MAX)) | 462 | if ((a1.rel_value_us == UINT64_MAX) || (a2.rel_value_us == UINT64_MAX)) |
452 | return GNUNET_TIME_UNIT_FOREVER_REL; | 463 | return GNUNET_TIME_UNIT_FOREVER_REL; |
453 | if (a1.rel_value + a2.rel_value < a1.rel_value) | 464 | if (a1.rel_value_us + a2.rel_value_us < a1.rel_value_us) |
454 | { | 465 | { |
455 | GNUNET_break (0); | 466 | GNUNET_break (0); |
456 | return GNUNET_TIME_UNIT_FOREVER_REL; | 467 | return GNUNET_TIME_UNIT_FOREVER_REL; |
457 | } | 468 | } |
458 | ret.rel_value = a1.rel_value + a2.rel_value; | 469 | ret.rel_value_us = a1.rel_value_us + a2.rel_value_us; |
459 | return ret; | 470 | return ret; |
460 | } | 471 | } |
461 | 472 | ||
@@ -473,11 +484,11 @@ GNUNET_TIME_relative_subtract (struct GNUNET_TIME_Relative a1, | |||
473 | { | 484 | { |
474 | struct GNUNET_TIME_Relative ret; | 485 | struct GNUNET_TIME_Relative ret; |
475 | 486 | ||
476 | if (a2.rel_value >= a1.rel_value) | 487 | if (a2.rel_value_us >= a1.rel_value_us) |
477 | return GNUNET_TIME_UNIT_ZERO; | 488 | return GNUNET_TIME_UNIT_ZERO; |
478 | if (a1.rel_value == UINT64_MAX) | 489 | if (a1.rel_value_us == UINT64_MAX) |
479 | return GNUNET_TIME_UNIT_FOREVER_REL; | 490 | return GNUNET_TIME_UNIT_FOREVER_REL; |
480 | ret.rel_value = a1.rel_value - a2.rel_value; | 491 | ret.rel_value_us = a1.rel_value_us - a2.rel_value_us; |
481 | return ret; | 492 | return ret; |
482 | } | 493 | } |
483 | 494 | ||
@@ -493,7 +504,7 @@ GNUNET_TIME_relative_hton (struct GNUNET_TIME_Relative a) | |||
493 | { | 504 | { |
494 | struct GNUNET_TIME_RelativeNBO ret; | 505 | struct GNUNET_TIME_RelativeNBO ret; |
495 | 506 | ||
496 | ret.rel_value__ = GNUNET_htonll (a.rel_value); | 507 | ret.rel_value_us__ = GNUNET_htonll (a.rel_value_us); |
497 | return ret; | 508 | return ret; |
498 | } | 509 | } |
499 | 510 | ||
@@ -509,7 +520,7 @@ GNUNET_TIME_relative_ntoh (struct GNUNET_TIME_RelativeNBO a) | |||
509 | { | 520 | { |
510 | struct GNUNET_TIME_Relative ret; | 521 | struct GNUNET_TIME_Relative ret; |
511 | 522 | ||
512 | ret.rel_value = GNUNET_ntohll (a.rel_value__); | 523 | ret.rel_value_us = GNUNET_ntohll (a.rel_value_us__); |
513 | return ret; | 524 | return ret; |
514 | 525 | ||
515 | } | 526 | } |
@@ -526,7 +537,7 @@ GNUNET_TIME_absolute_hton (struct GNUNET_TIME_Absolute a) | |||
526 | { | 537 | { |
527 | struct GNUNET_TIME_AbsoluteNBO ret; | 538 | struct GNUNET_TIME_AbsoluteNBO ret; |
528 | 539 | ||
529 | ret.abs_value__ = GNUNET_htonll (a.abs_value); | 540 | ret.abs_value_us__ = GNUNET_htonll (a.abs_value_us); |
530 | return ret; | 541 | return ret; |
531 | } | 542 | } |
532 | 543 | ||
@@ -542,7 +553,7 @@ GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a) | |||
542 | { | 553 | { |
543 | struct GNUNET_TIME_Absolute ret; | 554 | struct GNUNET_TIME_Absolute ret; |
544 | 555 | ||
545 | ret.abs_value = GNUNET_ntohll (a.abs_value__); | 556 | ret.abs_value_us = GNUNET_ntohll (a.abs_value_us__); |
546 | return ret; | 557 | return ret; |
547 | 558 | ||
548 | } | 559 | } |
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index b4a4bbff5..e2cf3e5c9 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c | |||
@@ -1120,7 +1120,7 @@ route_packet (struct DestinationEntry *destination, | |||
1120 | ts->destination_port = destination_port; | 1120 | ts->destination_port = destination_port; |
1121 | ts->heap_node = GNUNET_CONTAINER_heap_insert (tunnel_heap, | 1121 | ts->heap_node = GNUNET_CONTAINER_heap_insert (tunnel_heap, |
1122 | ts, | 1122 | ts, |
1123 | GNUNET_TIME_absolute_get ().abs_value); | 1123 | GNUNET_TIME_absolute_get ().abs_value_us); |
1124 | GNUNET_assert (GNUNET_YES == | 1124 | GNUNET_assert (GNUNET_YES == |
1125 | GNUNET_CONTAINER_multihashmap_put (tunnel_map, | 1125 | GNUNET_CONTAINER_multihashmap_put (tunnel_map, |
1126 | &key, | 1126 | &key, |
@@ -1137,7 +1137,7 @@ route_packet (struct DestinationEntry *destination, | |||
1137 | is_new = GNUNET_NO; | 1137 | is_new = GNUNET_NO; |
1138 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, | 1138 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, |
1139 | ts->heap_node, | 1139 | ts->heap_node, |
1140 | GNUNET_TIME_absolute_get ().abs_value); | 1140 | GNUNET_TIME_absolute_get ().abs_value_us); |
1141 | } | 1141 | } |
1142 | GNUNET_assert (NULL != ts->tunnel); | 1142 | GNUNET_assert (NULL != ts->tunnel); |
1143 | 1143 | ||
@@ -2070,7 +2070,7 @@ receive_icmp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
2070 | } | 2070 | } |
2071 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, | 2071 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, |
2072 | ts->heap_node, | 2072 | ts->heap_node, |
2073 | GNUNET_TIME_absolute_get ().abs_value); | 2073 | GNUNET_TIME_absolute_get ().abs_value_us); |
2074 | return GNUNET_OK; | 2074 | return GNUNET_OK; |
2075 | } | 2075 | } |
2076 | 2076 | ||
@@ -2225,7 +2225,7 @@ receive_udp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
2225 | } | 2225 | } |
2226 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, | 2226 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, |
2227 | ts->heap_node, | 2227 | ts->heap_node, |
2228 | GNUNET_TIME_absolute_get ().abs_value); | 2228 | GNUNET_TIME_absolute_get ().abs_value_us); |
2229 | return GNUNET_OK; | 2229 | return GNUNET_OK; |
2230 | } | 2230 | } |
2231 | 2231 | ||
@@ -2367,7 +2367,7 @@ receive_tcp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
2367 | } | 2367 | } |
2368 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, | 2368 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, |
2369 | ts->heap_node, | 2369 | ts->heap_node, |
2370 | GNUNET_TIME_absolute_get ().abs_value); | 2370 | GNUNET_TIME_absolute_get ().abs_value_us); |
2371 | return GNUNET_OK; | 2371 | return GNUNET_OK; |
2372 | } | 2372 | } |
2373 | 2373 | ||
@@ -2708,7 +2708,7 @@ service_redirect_to_ip (void *cls GNUNET_UNUSED, struct GNUNET_SERVER_Client *cl | |||
2708 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); | 2708 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); |
2709 | de->heap_node = GNUNET_CONTAINER_heap_insert (destination_heap, | 2709 | de->heap_node = GNUNET_CONTAINER_heap_insert (destination_heap, |
2710 | de, | 2710 | de, |
2711 | GNUNET_TIME_absolute_ntoh (msg->expiration_time).abs_value); | 2711 | GNUNET_TIME_absolute_ntoh (msg->expiration_time).abs_value_us); |
2712 | GNUNET_STATISTICS_update (stats, | 2712 | GNUNET_STATISTICS_update (stats, |
2713 | gettext_noop ("# Active destinations"), | 2713 | gettext_noop ("# Active destinations"), |
2714 | 1, GNUNET_NO); | 2714 | 1, GNUNET_NO); |
@@ -2814,7 +2814,7 @@ service_redirect_to_service (void *cls GNUNET_UNUSED, struct GNUNET_SERVER_Clien | |||
2814 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); | 2814 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); |
2815 | de->heap_node = GNUNET_CONTAINER_heap_insert (destination_heap, | 2815 | de->heap_node = GNUNET_CONTAINER_heap_insert (destination_heap, |
2816 | de, | 2816 | de, |
2817 | GNUNET_TIME_absolute_ntoh (msg->expiration_time).abs_value); | 2817 | GNUNET_TIME_absolute_ntoh (msg->expiration_time).abs_value_us); |
2818 | while (GNUNET_CONTAINER_multihashmap_size (destination_map) > max_destination_mappings) | 2818 | while (GNUNET_CONTAINER_multihashmap_size (destination_map) > max_destination_mappings) |
2819 | expire_destination (de); | 2819 | expire_destination (de); |
2820 | ts = create_tunnel_to_destination (de, | 2820 | ts = create_tunnel_to_destination (de, |