Merge remote-tracking branch 'public/gcc-295-fix' into maint-0.2.2

This commit is contained in:
Nick Mathewson 2011-09-09 12:54:27 -04:00
commit b0695c11eb
11 changed files with 74 additions and 66 deletions

4
changes/bug3894 Normal file
View File

@ -0,0 +1,4 @@
o Build fixes:
- Clean up some code issues that prevented Tor from building on older
BSDs. Fixes bug 3894; reported by grarpamp.

View File

@ -229,7 +229,7 @@ dnl -------------------------------------------------------------------
dnl Check for functions before libevent, since libevent-1.2 apparently dnl Check for functions before libevent, since libevent-1.2 apparently
dnl exports strlcpy without defining it in a header. dnl exports strlcpy without defining it in a header.
AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit strlcat strlcpy strtoull getaddrinfo localtime_r gmtime_r memmem strtok_r writev readv flock prctl vasprintf) AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit strlcat strlcpy strtoull getaddrinfo localtime_r gmtime_r memmem strtok_r writev readv flock prctl vasprintf lround rint)
using_custom_malloc=no using_custom_malloc=no
if test x$enable_openbsd_malloc = xyes ; then if test x$enable_openbsd_malloc = xyes ; then

View File

@ -14,11 +14,12 @@
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include "torint.h"
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif
#include "torint.h"
#include "util.h" #include "util.h"
#include "torlog.h" #include "torlog.h"
#include "torgzip.h" #include "torgzip.h"

View File

@ -334,10 +334,12 @@ tor_mathlog(double d)
long long
tor_lround(double d) tor_lround(double d)
{ {
#ifdef _MSC_VER #if defined(HAVE_LROUND)
return (long)(d > 0 ? d + 0.5 : ceil(d - 0.5));
#else
return lround(d); return lround(d);
#elif defined(HAVE_RINT)
return (long)rint(d);
#else
return (long)(d > 0 ? d + 0.5 : ceil(d - 0.5));
#endif #endif
} }

View File

@ -1237,7 +1237,7 @@ circuit_build_times_network_check_changed(circuit_build_times_t *cbt)
if (cbt->timeout_ms >= circuit_build_times_get_initial_timeout()) { if (cbt->timeout_ms >= circuit_build_times_get_initial_timeout()) {
if (cbt->timeout_ms > INT32_MAX/2 || cbt->close_ms > INT32_MAX/2) { if (cbt->timeout_ms > INT32_MAX/2 || cbt->close_ms > INT32_MAX/2) {
log_warn(LD_CIRC, "Insanely large circuit build timeout value. " log_warn(LD_CIRC, "Insanely large circuit build timeout value. "
"(timeout = %lfmsec, close = %lfmsec)", "(timeout = %fmsec, close = %fmsec)",
cbt->timeout_ms, cbt->close_ms); cbt->timeout_ms, cbt->close_ms);
} else { } else {
cbt->timeout_ms *= 2; cbt->timeout_ms *= 2;
@ -1414,7 +1414,7 @@ circuit_build_times_set_timeout(circuit_build_times_t *cbt)
return; return;
if (cbt->timeout_ms < circuit_build_times_min_timeout()) { if (cbt->timeout_ms < circuit_build_times_min_timeout()) {
log_warn(LD_CIRC, "Set buildtimeout to low value %lfms. Setting to %dms", log_warn(LD_CIRC, "Set buildtimeout to low value %fms. Setting to %dms",
cbt->timeout_ms, circuit_build_times_min_timeout()); cbt->timeout_ms, circuit_build_times_min_timeout());
cbt->timeout_ms = circuit_build_times_min_timeout(); cbt->timeout_ms = circuit_build_times_min_timeout();
if (cbt->close_ms < cbt->timeout_ms) { if (cbt->close_ms < cbt->timeout_ms) {
@ -1436,7 +1436,7 @@ circuit_build_times_set_timeout(circuit_build_times_t *cbt)
cbt->total_build_times, cbt->total_build_times,
tor_lround(cbt->timeout_ms/1000)); tor_lround(cbt->timeout_ms/1000));
log_info(LD_CIRC, log_info(LD_CIRC,
"Circuit timeout data: %lfms, %lfms, Xm: %d, a: %lf, r: %lf", "Circuit timeout data: %fms, %fms, Xm: %d, a: %f, r: %f",
cbt->timeout_ms, cbt->close_ms, cbt->Xm, cbt->alpha, cbt->timeout_ms, cbt->close_ms, cbt->Xm, cbt->alpha,
timeout_rate); timeout_rate);
} else if (prev_timeout < tor_lround(cbt->timeout_ms/1000)) { } else if (prev_timeout < tor_lround(cbt->timeout_ms/1000)) {
@ -1447,13 +1447,13 @@ circuit_build_times_set_timeout(circuit_build_times_t *cbt)
cbt->total_build_times, cbt->total_build_times,
tor_lround(cbt->timeout_ms/1000)); tor_lround(cbt->timeout_ms/1000));
log_info(LD_CIRC, log_info(LD_CIRC,
"Circuit timeout data: %lfms, %lfms, Xm: %d, a: %lf, r: %lf", "Circuit timeout data: %fms, %fms, Xm: %d, a: %f, r: %f",
cbt->timeout_ms, cbt->close_ms, cbt->Xm, cbt->alpha, cbt->timeout_ms, cbt->close_ms, cbt->Xm, cbt->alpha,
timeout_rate); timeout_rate);
} else { } else {
log_info(LD_CIRC, log_info(LD_CIRC,
"Set circuit build timeout to %lds (%lfms, %lfms, Xm: %d, a: %lf," "Set circuit build timeout to %lds (%fms, %fms, Xm: %d, a: %f,"
" r: %lf) based on %d circuit times", " r: %f) based on %d circuit times",
tor_lround(cbt->timeout_ms/1000), tor_lround(cbt->timeout_ms/1000),
cbt->timeout_ms, cbt->close_ms, cbt->Xm, cbt->alpha, timeout_rate, cbt->timeout_ms, cbt->close_ms, cbt->Xm, cbt->alpha, timeout_rate,
cbt->total_build_times); cbt->total_build_times);
@ -4095,7 +4095,7 @@ choose_random_entry(cpath_build_state_t *state)
retry: retry:
smartlist_clear(live_entry_guards); smartlist_clear(live_entry_guards);
SMARTLIST_FOREACH(entry_guards, entry_guard_t *, entry, SMARTLIST_FOREACH_BEGIN(entry_guards, entry_guard_t *, entry)
{ {
const char *msg; const char *msg;
r = entry_is_live(entry, need_uptime, need_capacity, 0, &msg); r = entry_is_live(entry, need_uptime, need_capacity, 0, &msg);
@ -4131,7 +4131,8 @@ choose_random_entry(cpath_build_state_t *state)
} }
if (smartlist_len(live_entry_guards) >= options->NumEntryGuards) if (smartlist_len(live_entry_guards) >= options->NumEntryGuards)
break; /* we have enough */ break; /* we have enough */
}); }
SMARTLIST_FOREACH_END(entry);
if (entry_list_is_constrained(options)) { if (entry_list_is_constrained(options)) {
/* If we prefer the entry nodes we've got, and we have at least /* If we prefer the entry nodes we've got, and we have at least

View File

@ -3712,8 +3712,8 @@ control_event_buildtimeout_set(const circuit_build_times_t *cbt,
send_control_event(EVENT_BUILDTIMEOUT_SET, ALL_FORMATS, send_control_event(EVENT_BUILDTIMEOUT_SET, ALL_FORMATS,
"650 BUILDTIMEOUT_SET %s TOTAL_TIMES=%lu " "650 BUILDTIMEOUT_SET %s TOTAL_TIMES=%lu "
"TIMEOUT_MS=%lu XM=%lu ALPHA=%lf CUTOFF_QUANTILE=%lf " "TIMEOUT_MS=%lu XM=%lu ALPHA=%f CUTOFF_QUANTILE=%f "
"TIMEOUT_RATE=%lf CLOSE_MS=%lu CLOSE_RATE=%lf\r\n", "TIMEOUT_RATE=%f CLOSE_MS=%lu CLOSE_RATE=%f\r\n",
type_string, (unsigned long)cbt->total_build_times, type_string, (unsigned long)cbt->total_build_times,
(unsigned long)cbt->timeout_ms, (unsigned long)cbt->timeout_ms,
(unsigned long)cbt->Xm, cbt->alpha, qnt, (unsigned long)cbt->Xm, cbt->alpha, qnt,

View File

@ -2028,7 +2028,7 @@ cell_ewma_set_scale_factor(or_options_t *options, networkstatus_t *consensus)
ewma_enabled = 1; ewma_enabled = 1;
log_info(LD_OR, log_info(LD_OR,
"Enabled cell_ewma algorithm because of value in %s; " "Enabled cell_ewma algorithm because of value in %s; "
"scale factor is %lf per %d seconds", "scale factor is %f per %d seconds",
source, ewma_scale_factor, EWMA_TICK_LEN); source, ewma_scale_factor, EWMA_TICK_LEN);
} }
} }

View File

@ -445,7 +445,7 @@ rep_hist_downrate_old_runs(time_t now)
alpha *= STABILITY_ALPHA; alpha *= STABILITY_ALPHA;
} }
log_info(LD_HIST, "Discounting all old stability info by a factor of %lf", log_info(LD_HIST, "Discounting all old stability info by a factor of %f",
alpha); alpha);
/* Multiply every w_r_l, t_r_w pair by alpha. */ /* Multiply every w_r_l, t_r_w pair by alpha. */
@ -893,7 +893,7 @@ rep_hist_format_router_status(or_history_t *hist, time_t now)
" weighted-uptime %lu\n" " weighted-uptime %lu\n"
"mtbf %0.1lf\n" "mtbf %0.1lf\n"
" weighted-run-length %lu\n" " weighted-run-length %lu\n"
" total-run-weights %lf\n", " total-run-weights %f\n",
up?"uptime-started ":"", up?sor_buf:"", up?" UTC\n":"", up?"uptime-started ":"", up?sor_buf:"", up?" UTC\n":"",
down?"downtime-started ":"", down?sod_buf:"", down?" UTC\n":"", down?"downtime-started ":"", down?sod_buf:"", down?" UTC\n":"",
wfu, wfu,

View File

@ -1815,7 +1815,7 @@ smartlist_choose_by_bandwidth_weights(smartlist_t *sl,
sl_last_total_weighted_bw = weighted_bw; sl_last_total_weighted_bw = weighted_bw;
log_debug(LD_CIRC, "Choosing node for rule %s based on weights " log_debug(LD_CIRC, "Choosing node for rule %s based on weights "
"Wg=%lf Wm=%lf We=%lf Wd=%lf with total bw %lf", "Wg=%f Wm=%f We=%f Wd=%f with total bw %f",
bandwidth_weight_rule_to_string(rule), bandwidth_weight_rule_to_string(rule),
Wg, Wm, We, Wd, weighted_bw); Wg, Wm, We, Wd, weighted_bw);
@ -1824,7 +1824,7 @@ smartlist_choose_by_bandwidth_weights(smartlist_t *sl,
/* Don't warn when using bridges/relays not in the consensus */ /* Don't warn when using bridges/relays not in the consensus */
if (!have_unknown) if (!have_unknown)
log_warn(LD_CIRC, log_warn(LD_CIRC,
"Weighted bandwidth is %lf in node selection for rule %s", "Weighted bandwidth is %f in node selection for rule %s",
weighted_bw, bandwidth_weight_rule_to_string(rule)); weighted_bw, bandwidth_weight_rule_to_string(rule));
tor_free(bandwidths); tor_free(bandwidths);
return smartlist_choose(sl); return smartlist_choose(sl);
@ -1849,7 +1849,7 @@ smartlist_choose_by_bandwidth_weights(smartlist_t *sl,
--i; --i;
log_warn(LD_BUG, "Round-off error in computing bandwidth had an effect on " log_warn(LD_BUG, "Round-off error in computing bandwidth had an effect on "
" which router we chose. Please tell the developers. " " which router we chose. Please tell the developers. "
"%lf " U64_FORMAT " %lf", tmp, U64_PRINTF_ARG(rand_bw), "%f " U64_FORMAT " %f", tmp, U64_PRINTF_ARG(rand_bw),
weighted_bw); weighted_bw);
} }
tor_free(bandwidths); tor_free(bandwidths);
@ -2074,10 +2074,10 @@ smartlist_choose_by_bandwidth(smartlist_t *sl, bandwidth_weight_rule_t rule,
log_debug(LD_CIRC, "Total weighted bw = "U64_FORMAT log_debug(LD_CIRC, "Total weighted bw = "U64_FORMAT
", exit bw = "U64_FORMAT ", exit bw = "U64_FORMAT
", nonexit bw = "U64_FORMAT", exit weight = %lf " ", nonexit bw = "U64_FORMAT", exit weight = %f "
"(for exit == %d)" "(for exit == %d)"
", guard bw = "U64_FORMAT ", guard bw = "U64_FORMAT
", nonguard bw = "U64_FORMAT", guard weight = %lf " ", nonguard bw = "U64_FORMAT", guard weight = %f "
"(for guard == %d)", "(for guard == %d)",
U64_PRINTF_ARG(total_bw), U64_PRINTF_ARG(total_bw),
U64_PRINTF_ARG(total_exit_bw), U64_PRINTF_ARG(total_nonexit_bw), U64_PRINTF_ARG(total_exit_bw), U64_PRINTF_ARG(total_nonexit_bw),

View File

@ -2419,40 +2419,40 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
// We use > 1 as the check for these because they are computed as integers. // We use > 1 as the check for these because they are computed as integers.
// Sometimes there are rounding errors. // Sometimes there are rounding errors.
if (fabs(Wmm - weight_scale) > 1) { if (fabs(Wmm - weight_scale) > 1) {
log_warn(LD_BUG, "Wmm=%lf != "I64_FORMAT, log_warn(LD_BUG, "Wmm=%f != "I64_FORMAT,
Wmm, I64_PRINTF_ARG(weight_scale)); Wmm, I64_PRINTF_ARG(weight_scale));
valid = 0; valid = 0;
} }
if (fabs(Wem - Wee) > 1) { if (fabs(Wem - Wee) > 1) {
log_warn(LD_BUG, "Wem=%lf != Wee=%lf", Wem, Wee); log_warn(LD_BUG, "Wem=%f != Wee=%f", Wem, Wee);
valid = 0; valid = 0;
} }
if (fabs(Wgm - Wgg) > 1) { if (fabs(Wgm - Wgg) > 1) {
log_warn(LD_BUG, "Wgm=%lf != Wgg=%lf", Wgm, Wgg); log_warn(LD_BUG, "Wgm=%f != Wgg=%f", Wgm, Wgg);
valid = 0; valid = 0;
} }
if (fabs(Weg - Wed) > 1) { if (fabs(Weg - Wed) > 1) {
log_warn(LD_BUG, "Wed=%lf != Weg=%lf", Wed, Weg); log_warn(LD_BUG, "Wed=%f != Weg=%f", Wed, Weg);
valid = 0; valid = 0;
} }
if (fabs(Wgg + Wmg - weight_scale) > 0.001*weight_scale) { if (fabs(Wgg + Wmg - weight_scale) > 0.001*weight_scale) {
log_warn(LD_BUG, "Wgg=%lf != "I64_FORMAT" - Wmg=%lf", Wgg, log_warn(LD_BUG, "Wgg=%f != "I64_FORMAT" - Wmg=%f", Wgg,
I64_PRINTF_ARG(weight_scale), Wmg); I64_PRINTF_ARG(weight_scale), Wmg);
valid = 0; valid = 0;
} }
if (fabs(Wee + Wme - weight_scale) > 0.001*weight_scale) { if (fabs(Wee + Wme - weight_scale) > 0.001*weight_scale) {
log_warn(LD_BUG, "Wee=%lf != "I64_FORMAT" - Wme=%lf", Wee, log_warn(LD_BUG, "Wee=%f != "I64_FORMAT" - Wme=%f", Wee,
I64_PRINTF_ARG(weight_scale), Wme); I64_PRINTF_ARG(weight_scale), Wme);
valid = 0; valid = 0;
} }
if (fabs(Wgd + Wmd + Wed - weight_scale) > 0.001*weight_scale) { if (fabs(Wgd + Wmd + Wed - weight_scale) > 0.001*weight_scale) {
log_warn(LD_BUG, "Wgd=%lf + Wmd=%lf + Wed=%lf != "I64_FORMAT, log_warn(LD_BUG, "Wgd=%f + Wmd=%f + Wed=%f != "I64_FORMAT,
Wgd, Wmd, Wed, I64_PRINTF_ARG(weight_scale)); Wgd, Wmd, Wed, I64_PRINTF_ARG(weight_scale));
valid = 0; valid = 0;
} }
@ -2507,10 +2507,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
casename = "Case 1"; casename = "Case 1";
if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) { if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: Etotal %lf != Mtotal %lf. " "Bw Weight Failure for %s: Etotal %f != Mtotal %f. "
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
" T="I64_FORMAT". " " T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Etotal, Mtotal, casename, Etotal, Mtotal,
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2519,10 +2519,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
} }
if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) { if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: Etotal %lf != Gtotal %lf. " "Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
" T="I64_FORMAT". " " T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Etotal, Gtotal, casename, Etotal, Gtotal,
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2531,10 +2531,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
} }
if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) { if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: Mtotal %lf != Gtotal %lf. " "Bw Weight Failure for %s: Mtotal %f != Gtotal %f. "
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
" T="I64_FORMAT". " " T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Mtotal, Gtotal, casename, Mtotal, Gtotal,
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2563,10 +2563,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
// Rtotal < Stotal // Rtotal < Stotal
if (Rtotal > Stotal) { if (Rtotal > Stotal) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: Rtotal %lf > Stotal %lf. " "Bw Weight Failure for %s: Rtotal %f > Stotal %f. "
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
" T="I64_FORMAT". " " T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Rtotal, Stotal, casename, Rtotal, Stotal,
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2576,10 +2576,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
// Rtotal < T/3 // Rtotal < T/3
if (3*Rtotal > T) { if (3*Rtotal > T) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: 3*Rtotal %lf > T " "Bw Weight Failure for %s: 3*Rtotal %f > T "
I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT
" D="I64_FORMAT" T="I64_FORMAT". " " D="I64_FORMAT" T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Rtotal*3, I64_PRINTF_ARG(T), casename, Rtotal*3, I64_PRINTF_ARG(T),
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2589,10 +2589,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
// Stotal < T/3 // Stotal < T/3
if (3*Stotal > T) { if (3*Stotal > T) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: 3*Stotal %lf > T " "Bw Weight Failure for %s: 3*Stotal %f > T "
I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT
" D="I64_FORMAT" T="I64_FORMAT". " " D="I64_FORMAT" T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Stotal*3, I64_PRINTF_ARG(T), casename, Stotal*3, I64_PRINTF_ARG(T),
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2602,11 +2602,11 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
// Mtotal > T/3 // Mtotal > T/3
if (3*Mtotal < T) { if (3*Mtotal < T) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: 3*Mtotal %lf < T " "Bw Weight Failure for %s: 3*Mtotal %f < T "
I64_FORMAT". " I64_FORMAT". "
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
" T="I64_FORMAT". " " T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Mtotal*3, I64_PRINTF_ARG(T), casename, Mtotal*3, I64_PRINTF_ARG(T),
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2621,10 +2621,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
casename = "Case 2b (balanced)"; casename = "Case 2b (balanced)";
if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) { if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: Etotal %lf != Mtotal %lf. " "Bw Weight Failure for %s: Etotal %f != Mtotal %f. "
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
" T="I64_FORMAT". " " T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Etotal, Mtotal, casename, Etotal, Mtotal,
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2633,10 +2633,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
} }
if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) { if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: Etotal %lf != Gtotal %lf. " "Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
" T="I64_FORMAT". " " T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Etotal, Gtotal, casename, Etotal, Gtotal,
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2645,10 +2645,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
} }
if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) { if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: Mtotal %lf != Gtotal %lf. " "Bw Weight Failure for %s: Mtotal %f != Gtotal %f. "
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
" T="I64_FORMAT". " " T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Mtotal, Gtotal, casename, Mtotal, Gtotal,
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2658,10 +2658,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
} else { } else {
if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) { if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: Etotal %lf != Gtotal %lf. " "Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
" T="I64_FORMAT". " " T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Etotal, Gtotal, casename, Etotal, Gtotal,
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2688,10 +2688,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
// Stotal < T/3 // Stotal < T/3
if (3*Stotal > T) { if (3*Stotal > T) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: 3*Stotal %lf > T " "Bw Weight Failure for %s: 3*Stotal %f > T "
I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT
" D="I64_FORMAT" T="I64_FORMAT". " " D="I64_FORMAT" T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Stotal*3, I64_PRINTF_ARG(T), casename, Stotal*3, I64_PRINTF_ARG(T),
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2701,10 +2701,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
if (NS >= M) { if (NS >= M) {
if (fabs(NStotal-Mtotal) > 0.01*MAX(NStotal,Mtotal)) { if (fabs(NStotal-Mtotal) > 0.01*MAX(NStotal,Mtotal)) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: NStotal %lf != Mtotal %lf. " "Bw Weight Failure for %s: NStotal %f != Mtotal %f. "
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
" T="I64_FORMAT". " " T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, NStotal, Mtotal, casename, NStotal, Mtotal,
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2715,10 +2715,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
// if NS < M, NStotal > T/3 because only one of G or E is scarce // if NS < M, NStotal > T/3 because only one of G or E is scarce
if (3*NStotal < T) { if (3*NStotal < T) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: 3*NStotal %lf < T " "Bw Weight Failure for %s: 3*NStotal %f < T "
I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT
" E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT". " " E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, NStotal*3, I64_PRINTF_ARG(T), casename, NStotal*3, I64_PRINTF_ARG(T),
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2730,10 +2730,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
casename = "Case 3b"; casename = "Case 3b";
if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) { if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: Etotal %lf != Mtotal %lf. " "Bw Weight Failure for %s: Etotal %f != Mtotal %f. "
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
" T="I64_FORMAT". " " T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Etotal, Mtotal, casename, Etotal, Mtotal,
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2742,10 +2742,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
} }
if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) { if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: Etotal %lf != Gtotal %lf. " "Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
" T="I64_FORMAT". " " T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Etotal, Gtotal, casename, Etotal, Gtotal,
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
@ -2754,10 +2754,10 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
} }
if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) { if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) {
log_warn(LD_DIR, log_warn(LD_DIR,
"Bw Weight Failure for %s: Mtotal %lf != Gtotal %lf. " "Bw Weight Failure for %s: Mtotal %f != Gtotal %f. "
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT "G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
" T="I64_FORMAT". " " T="I64_FORMAT". "
"Wgg=%lf Wgd=%lf Wmg=%lf Wme=%lf Wmd=%lf Wee=%lf Wed=%lf", "Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
casename, Mtotal, Gtotal, casename, Mtotal, Gtotal,
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E), I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T), I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),

View File

@ -455,7 +455,7 @@ test_circuit_timeout(void)
timeout1 = circuit_build_times_calculate_timeout(&estimate, timeout1 = circuit_build_times_calculate_timeout(&estimate,
CBT_DEFAULT_QUANTILE_CUTOFF/100.0); CBT_DEFAULT_QUANTILE_CUTOFF/100.0);
circuit_build_times_set_timeout(&estimate); circuit_build_times_set_timeout(&estimate);
log_notice(LD_CIRC, "Timeout1 is %lf, Xm is %d", timeout1, estimate.Xm); log_notice(LD_CIRC, "Timeout1 is %f, Xm is %d", timeout1, estimate.Xm);
/* 2% error */ /* 2% error */
} while (fabs(circuit_build_times_cdf(&initial, timeout0) - } while (fabs(circuit_build_times_cdf(&initial, timeout0) -
circuit_build_times_cdf(&initial, timeout1)) > 0.02); circuit_build_times_cdf(&initial, timeout1)) > 0.02);
@ -470,7 +470,7 @@ test_circuit_timeout(void)
CBT_DEFAULT_QUANTILE_CUTOFF/100.0); CBT_DEFAULT_QUANTILE_CUTOFF/100.0);
circuit_build_times_set_timeout(&final); circuit_build_times_set_timeout(&final);
log_notice(LD_CIRC, "Timeout2 is %lf, Xm is %d", timeout2, final.Xm); log_notice(LD_CIRC, "Timeout2 is %f, Xm is %d", timeout2, final.Xm);
/* 5% here because some accuracy is lost due to histogram conversion */ /* 5% here because some accuracy is lost due to histogram conversion */
test_assert(fabs(circuit_build_times_cdf(&initial, timeout0) - test_assert(fabs(circuit_build_times_cdf(&initial, timeout0) -