Merge branch 'bug14950_logs_squashed'

This commit is contained in:
Nick Mathewson 2015-02-23 13:04:03 -05:00
commit d74a78c58a
6 changed files with 39 additions and 19 deletions

View File

@ -1793,7 +1793,7 @@ tor_getpwnam(const char *username)
if ((pw = getpwnam(username))) { if ((pw = getpwnam(username))) {
tor_passwd_free(passwd_cached); tor_passwd_free(passwd_cached);
passwd_cached = tor_passwd_dup(pw); passwd_cached = tor_passwd_dup(pw);
log_notice(LD_GENERAL, "Caching new entry %s for %s", log_info(LD_GENERAL, "Caching new entry %s for %s",
passwd_cached->pw_name, username); passwd_cached->pw_name, username);
return pw; return pw;
} }

View File

@ -960,7 +960,11 @@ circuit_send_next_onion_skin(origin_circuit_t *circ)
log_notice(LD_GENERAL, log_notice(LD_GENERAL,
"Tor has successfully opened a circuit. " "Tor has successfully opened a circuit. "
"Looks like client functionality is working."); "Looks like client functionality is working.");
control_event_bootstrap(BOOTSTRAP_STATUS_DONE, 0); if (control_event_bootstrap(BOOTSTRAP_STATUS_DONE, 0) == 0) {
log_notice(LD_GENERAL,
"Tor has successfully opened a circuit. "
"Looks like client functionality is working.");
}
control_event_client_status(LOG_NOTICE, "CIRCUIT_ESTABLISHED"); control_event_client_status(LOG_NOTICE, "CIRCUIT_ESTABLISHED");
clear_broken_connection_map(1); clear_broken_connection_map(1);
if (server_mode(options) && !check_whether_orport_reachable()) { if (server_mode(options) && !check_whether_orport_reachable()) {

View File

@ -4971,15 +4971,18 @@ static int bootstrap_problems = 0;
* *
* <b>status</b> is the new status, that is, what task we will be doing * <b>status</b> is the new status, that is, what task we will be doing
* next. <b>progress</b> is zero if we just started this task, else it * next. <b>progress</b> is zero if we just started this task, else it
* represents progress on the task. */ * represents progress on the task.
void *
* Return true if we logged a message at level NOTICE, and false otherwise.
*/
int
control_event_bootstrap(bootstrap_status_t status, int progress) control_event_bootstrap(bootstrap_status_t status, int progress)
{ {
const char *tag, *summary; const char *tag, *summary;
char buf[BOOTSTRAP_MSG_LEN]; char buf[BOOTSTRAP_MSG_LEN];
if (bootstrap_percent == BOOTSTRAP_STATUS_DONE) if (bootstrap_percent == BOOTSTRAP_STATUS_DONE)
return; /* already bootstrapped; nothing to be done here. */ return 0; /* already bootstrapped; nothing to be done here. */
/* special case for handshaking status, since our TLS handshaking code /* special case for handshaking status, since our TLS handshaking code
* can't distinguish what the connection is going to be for. */ * can't distinguish what the connection is going to be for. */
@ -5026,7 +5029,10 @@ control_event_bootstrap(bootstrap_status_t status, int progress)
/* Remember that we gave a notice at this level. */ /* Remember that we gave a notice at this level. */
notice_bootstrap_percent = bootstrap_percent; notice_bootstrap_percent = bootstrap_percent;
} }
return loglevel == LOG_NOTICE;
} }
return 0;
} }
/** Called when Tor has failed to make bootstrapping progress in a way /** Called when Tor has failed to make bootstrapping progress in a way

View File

@ -92,7 +92,7 @@ void enable_control_logging(void);
void monitor_owning_controller_process(const char *process_spec); void monitor_owning_controller_process(const char *process_spec);
void control_event_bootstrap(bootstrap_status_t status, int progress); int control_event_bootstrap(bootstrap_status_t status, int progress);
MOCK_DECL(void, control_event_bootstrap_problem,(const char *warn, MOCK_DECL(void, control_event_bootstrap_problem,(const char *warn,
int reason, int reason,
or_connection_t *or_conn)); or_connection_t *or_conn));

View File

@ -1698,10 +1698,11 @@ update_router_have_minimum_dir_info(void)
/* If paths have just become available in this update. */ /* If paths have just become available in this update. */
if (res && !have_min_dir_info) { if (res && !have_min_dir_info) {
control_event_client_status(LOG_NOTICE, "ENOUGH_DIR_INFO");
if (control_event_bootstrap(BOOTSTRAP_STATUS_CONN_OR, 0) == 0) {
log_notice(LD_DIR, log_notice(LD_DIR,
"We now have enough directory information to build circuits."); "We now have enough directory information to build circuits.");
control_event_client_status(LOG_NOTICE, "ENOUGH_DIR_INFO"); }
control_event_bootstrap(BOOTSTRAP_STATUS_CONN_OR, 0);
} }
/* If paths have just become unavailable in this update. */ /* If paths have just become unavailable in this update. */

View File

@ -117,15 +117,24 @@ log_heartbeat(time_t now)
log_accounting(now, options); log_accounting(now, options);
} }
if (stats_n_data_cells_packaged && !hibernating) double fullness_pct = 100;
log_notice(LD_HEARTBEAT, "Average packaged cell fullness: %2.3f%%", if (stats_n_data_cells_packaged && !hibernating) {
fullness_pct =
100*(U64_TO_DBL(stats_n_data_bytes_packaged) / 100*(U64_TO_DBL(stats_n_data_bytes_packaged) /
U64_TO_DBL(stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE)) ); U64_TO_DBL(stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE));
if (r > 1.0) {
double overhead = ( r - 1.0 ) * 100.0;
log_notice(LD_HEARTBEAT, "TLS write overhead: %.f%%", overhead);
} }
const double overhead_pct = ( r - 1.0 ) * 100.0;
#define FULLNESS_PCT_THRESHOLD 80
#define TLS_OVERHEAD_THRESHOLD 15
const int severity = (fullness_pct < FULLNESS_PCT_THRESHOLD ||
overhead_pct > TLS_OVERHEAD_THRESHOLD)
? LOG_NOTICE : LOG_INFO;
log_fn(severity, LD_HEARTBEAT,
"Average packaged cell fullness: %2.3f%%"
"TLS write overhead: %.f%%", fullness_pct, overhead_pct);
if (public_server_mode(options)) if (public_server_mode(options))
rep_hist_log_circuit_handshake_stats(now); rep_hist_log_circuit_handshake_stats(now);