clean up logging,

make it clearer which warns are bugs,
make the control log event match its specification,
point out a bug in how we deal with failure when renewing the tls context.


svn:r3138
This commit is contained in:
Roger Dingledine 2004-12-13 00:44:39 +00:00
parent 972124aab9
commit 011ad3cba5
13 changed files with 54 additions and 53 deletions

View File

@ -573,12 +573,12 @@ int circuit_init_cpath_crypto(crypt_path_t *cpath, char *key_data, int reverse)
// (unsigned int)*(uint32_t*)(key_data+40), (unsigned int)*(uint32_t*)(key_data+40+16)); // (unsigned int)*(uint32_t*)(key_data+40), (unsigned int)*(uint32_t*)(key_data+40+16));
if (!(cpath->f_crypto = if (!(cpath->f_crypto =
crypto_create_init_cipher(key_data+(2*DIGEST_LEN),1))) { crypto_create_init_cipher(key_data+(2*DIGEST_LEN),1))) {
log(LOG_WARN,"forward cipher initialization failed."); log(LOG_WARN,"Bug: forward cipher initialization failed.");
return -1; return -1;
} }
if (!(cpath->b_crypto = if (!(cpath->b_crypto =
crypto_create_init_cipher(key_data+(2*DIGEST_LEN)+CIPHER_KEY_LEN,0))) { crypto_create_init_cipher(key_data+(2*DIGEST_LEN)+CIPHER_KEY_LEN,0))) {
log(LOG_WARN,"backward cipher initialization failed."); log(LOG_WARN,"Bug: backward cipher initialization failed.");
return -1; return -1;
} }
@ -758,7 +758,7 @@ static int new_route_len(double cw, uint8_t purpose, smartlist_t *routers) {
else if (purpose == CIRCUIT_PURPOSE_S_CONNECT_REND) else if (purpose == CIRCUIT_PURPOSE_S_CONNECT_REND)
routelen = 4; routelen = 4;
else { else {
log_fn(LOG_WARN,"Unhandled purpose %d", purpose); log_fn(LOG_WARN,"Bug: unhandled purpose %d", purpose);
return -1; return -1;
} }
#endif #endif
@ -985,7 +985,7 @@ static routerinfo_t *choose_good_exit_server_general(routerlist_t *dir)
smartlist_t *needed_ports = circuit_get_unhandled_ports(time(NULL)); smartlist_t *needed_ports = circuit_get_unhandled_ports(time(NULL));
if (best_support == -1) { if (best_support == -1) {
log(LOG_WARN, "All routers are down or middleman -- choosing a doomed exit at random."); log(LOG_NOTICE, "All routers are down or middleman -- choosing a doomed exit at random.");
} }
for (try = 0; try < 2; try++) { for (try = 0; try < 2; try++) {
/* try once to pick only from routers that satisfy a needed port, /* try once to pick only from routers that satisfy a needed port,
@ -1047,7 +1047,7 @@ static routerinfo_t *choose_good_exit_server(uint8_t purpose, routerlist_t *dir)
NULL, 0, 1, options->_AllowUnverified & ALLOW_UNVERIFIED_RENDEZVOUS, 0); NULL, 0, 1, options->_AllowUnverified & ALLOW_UNVERIFIED_RENDEZVOUS, 0);
return r; return r;
} }
log_fn(LOG_WARN,"Unhandled purpose %d", purpose); log_fn(LOG_WARN,"Bug: unhandled purpose %d", purpose);
return NULL; return NULL;
} }

View File

@ -721,7 +721,7 @@ circuit_get_open_circ_or_launch(connection_t *conn,
if (!is_resolve && !connection_edge_is_rendezvous_stream(conn)) { if (!is_resolve && !connection_edge_is_rendezvous_stream(conn)) {
addr = client_dns_lookup_entry(conn->socks_request->address); addr = client_dns_lookup_entry(conn->socks_request->address);
if (router_exit_policy_all_routers_reject(addr, conn->socks_request->port)) { if (router_exit_policy_all_routers_reject(addr, conn->socks_request->port)) {
log_fn(LOG_WARN,"No Tor server exists that allows exit to %s:%d. Rejecting.", log_fn(LOG_NOTICE,"No Tor server exists that allows exit to %s:%d. Rejecting.",
conn->socks_request->address, conn->socks_request->port); conn->socks_request->address, conn->socks_request->port);
return -1; return -1;
} }
@ -824,7 +824,7 @@ int connection_ap_handshake_attach_circuit(connection_t *conn) {
conn_age = time(NULL) - conn->timestamp_created; conn_age = time(NULL) - conn->timestamp_created;
if (conn_age > CONN_AP_MAX_ATTACH_DELAY) { if (conn_age > CONN_AP_MAX_ATTACH_DELAY) {
log_fn(LOG_WARN,"Giving up on unattached conn (%d sec old).", conn_age); log_fn(LOG_NOTICE,"Giving up on unattached conn (%d sec old).", conn_age);
return -1; return -1;
} }

View File

@ -200,7 +200,7 @@ void connection_about_to_close_connection(connection_t *conn)
if (conn->type == CONN_TYPE_AP || conn->type == CONN_TYPE_EXIT) { if (conn->type == CONN_TYPE_AP || conn->type == CONN_TYPE_EXIT) {
if (!conn->has_sent_end) if (!conn->has_sent_end)
log_fn(LOG_WARN,"Edge connection hasn't sent end yet? Bug."); log_fn(LOG_WARN,"Bug: Edge connection hasn't sent end yet?");
} }
switch (conn->type) { switch (conn->type) {
@ -266,7 +266,7 @@ void connection_close_immediate(connection_t *conn)
{ {
assert_connection_ok(conn,0); assert_connection_ok(conn,0);
if (conn->s < 0) { if (conn->s < 0) {
log_fn(LOG_WARN,"Attempt to close already-closed connection."); log_fn(LOG_WARN,"Bug: Attempt to close already-closed connection.");
return; return;
} }
if (conn->outbuf_flushlen) { if (conn->outbuf_flushlen) {
@ -290,7 +290,7 @@ _connection_mark_for_close(connection_t *conn)
assert_connection_ok(conn,0); assert_connection_ok(conn,0);
if (conn->marked_for_close) { if (conn->marked_for_close) {
log(LOG_WARN, "Double mark-for-close on connection."); log(LOG_WARN, "Bug: Double mark-for-close on connection.");
return -1; return -1;
} }
@ -326,7 +326,7 @@ void connection_expire_held_open(void)
if (conn->hold_open_until_flushed) { if (conn->hold_open_until_flushed) {
tor_assert(conn->marked_for_close); tor_assert(conn->marked_for_close);
if (now - conn->timestamp_lastwritten >= 15) { if (now - conn->timestamp_lastwritten >= 15) {
log_fn(LOG_WARN,"Giving up on marked_for_close conn that's been flushing for 15s (fd %d, type %s, state %d).", log_fn(LOG_NOTICE,"Giving up on marked_for_close conn that's been flushing for 15s (fd %d, type %s, state %d).",
conn->s, CONN_TYPE_TO_STRING(conn->type), conn->state); conn->s, CONN_TYPE_TO_STRING(conn->type), conn->state);
conn->hold_open_until_flushed = 0; conn->hold_open_until_flushed = 0;
} }
@ -429,7 +429,7 @@ static int connection_handle_listener_read(connection_t *conn, int new_type) {
if (ERRNO_IS_ACCEPT_EAGAIN(e)) { if (ERRNO_IS_ACCEPT_EAGAIN(e)) {
return 0; /* he hung up before we could accept(). that's fine. */ return 0; /* he hung up before we could accept(). that's fine. */
} else if (ERRNO_IS_ACCEPT_RESOURCE_LIMIT(e)) { } else if (ERRNO_IS_ACCEPT_RESOURCE_LIMIT(e)) {
log_fn(LOG_WARN,"accept failed: %s. Dropping incoming connection.", log_fn(LOG_NOTICE,"accept failed: %s. Dropping incoming connection.",
tor_socket_strerror(e)); tor_socket_strerror(e));
return 0; return 0;
} }
@ -447,7 +447,7 @@ static int connection_handle_listener_read(connection_t *conn, int new_type) {
if (new_type == CONN_TYPE_AP) { if (new_type == CONN_TYPE_AP) {
/* check sockspolicy to see if we should accept it */ /* check sockspolicy to see if we should accept it */
if (socks_policy_permits_address(ntohl(remote.sin_addr.s_addr)) == 0) { if (socks_policy_permits_address(ntohl(remote.sin_addr.s_addr)) == 0) {
log_fn(LOG_WARN,"Denying socks connection from untrusted address %s.", log_fn(LOG_NOTICE,"Denying socks connection from untrusted address %s.",
inet_ntoa(remote.sin_addr)); inet_ntoa(remote.sin_addr));
tor_close_socket(news); tor_close_socket(news);
return 0; return 0;
@ -456,7 +456,7 @@ static int connection_handle_listener_read(connection_t *conn, int new_type) {
if (new_type == CONN_TYPE_DIR) { if (new_type == CONN_TYPE_DIR) {
/* check dirpolicy to see if we should accept it */ /* check dirpolicy to see if we should accept it */
if (dir_policy_permits_address(ntohl(remote.sin_addr.s_addr)) == 0) { if (dir_policy_permits_address(ntohl(remote.sin_addr.s_addr)) == 0) {
log_fn(LOG_WARN,"Denying dir connection from address %s.", log_fn(LOG_NOTICE,"Denying dir connection from address %s.",
inet_ntoa(remote.sin_addr)); inet_ntoa(remote.sin_addr));
tor_close_socket(news); tor_close_socket(news);
return 0; return 0;
@ -650,7 +650,7 @@ static int retry_listeners(int type, struct config_line_t *cfg,
return 0; return 0;
/* Otherwise, warn the user and relaunch. */ /* Otherwise, warn the user and relaunch. */
log_fn(LOG_WARN,"We have %d %s(s) open, but we want %d; relaunching.", log_fn(LOG_NOTICE,"We have %d %s(s) open, but we want %d; relaunching.",
have, conn_type_to_string[type], want); have, conn_type_to_string[type], want);
} }
@ -1329,7 +1329,7 @@ static int connection_process_inbuf(connection_t *conn, int package_partial) {
case CONN_TYPE_CONTROL: case CONN_TYPE_CONTROL:
return connection_control_process_inbuf(conn); return connection_control_process_inbuf(conn);
default: default:
log_fn(LOG_WARN,"got unexpected conn type %d.", conn->type); log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type);
return -1; return -1;
} }
} }
@ -1361,7 +1361,7 @@ static int connection_finished_flushing(connection_t *conn) {
case CONN_TYPE_CONTROL: case CONN_TYPE_CONTROL:
return connection_control_finished_flushing(conn); return connection_control_finished_flushing(conn);
default: default:
log_fn(LOG_WARN,"got unexpected conn type %d.", conn->type); log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type);
return -1; return -1;
} }
} }
@ -1384,7 +1384,7 @@ static int connection_finished_connecting(connection_t *conn)
case CONN_TYPE_DIR: case CONN_TYPE_DIR:
return connection_dir_finished_connecting(conn); return connection_dir_finished_connecting(conn);
default: default:
log_fn(LOG_WARN,"got unexpected conn type %d.", conn->type); log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type);
return -1; return -1;
} }
} }
@ -1406,7 +1406,7 @@ static int connection_reached_eof(connection_t *conn)
case CONN_TYPE_CONTROL: case CONN_TYPE_CONTROL:
return connection_control_reached_eof(conn); return connection_control_reached_eof(conn);
default: default:
log_fn(LOG_WARN,"got unexpected conn type %d.", conn->type); log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type);
return -1; return -1;
} }
} }

View File

@ -92,7 +92,7 @@ int connection_edge_process_inbuf(connection_t *conn, int package_partial) {
conn_state_to_string[conn->type][conn->state]); conn_state_to_string[conn->type][conn->state]);
return 0; return 0;
} }
log_fn(LOG_WARN,"Got unexpected state %d. Closing.",conn->state); log_fn(LOG_WARN,"Bug: Got unexpected state %d. Closing.",conn->state);
connection_edge_end(conn, END_STREAM_REASON_MISC, conn->cpath_layer); connection_edge_end(conn, END_STREAM_REASON_MISC, conn->cpath_layer);
connection_mark_for_close(conn); connection_mark_for_close(conn);
return -1; return -1;
@ -130,7 +130,7 @@ connection_edge_end(connection_t *conn, char reason, crypt_path_t *cpath_layer)
circuit_t *circ; circuit_t *circ;
if (conn->has_sent_end) { if (conn->has_sent_end) {
log_fn(LOG_WARN,"It appears I've already sent the end. Are you calling me twice?"); log_fn(LOG_WARN,"Bug: Calling connection_edge_end on an already ended stream?");
return -1; return -1;
} }
@ -252,14 +252,14 @@ void connection_ap_expire_beginning(void) {
continue; continue;
circ = circuit_get_by_conn(conn); circ = circuit_get_by_conn(conn);
if (!circ) { /* it's vanished? */ if (!circ) { /* it's vanished? */
log_fn(LOG_WARN,"Conn is waiting (address %s), but lost its circ.", log_fn(LOG_INFO,"Conn is waiting (address %s), but lost its circ.",
conn->socks_request->address); conn->socks_request->address);
connection_mark_for_close(conn); connection_mark_for_close(conn);
continue; continue;
} }
if (circ->purpose == CIRCUIT_PURPOSE_C_REND_JOINED) { if (circ->purpose == CIRCUIT_PURPOSE_C_REND_JOINED) {
if (now - conn->timestamp_lastread > 45) { if (now - conn->timestamp_lastread > 45) {
log_fn(LOG_WARN,"Rend stream is %d seconds late. Giving up on address '%s'.", log_fn(LOG_NOTICE,"Rend stream is %d seconds late. Giving up on address '%s'.",
(int)(now - conn->timestamp_lastread), conn->socks_request->address); (int)(now - conn->timestamp_lastread), conn->socks_request->address);
connection_edge_end(conn, END_STREAM_REASON_TIMEOUT, conn->cpath_layer); connection_edge_end(conn, END_STREAM_REASON_TIMEOUT, conn->cpath_layer);
connection_mark_for_close(conn); connection_mark_for_close(conn);
@ -269,7 +269,7 @@ void connection_ap_expire_beginning(void) {
tor_assert(circ->purpose == CIRCUIT_PURPOSE_C_GENERAL); tor_assert(circ->purpose == CIRCUIT_PURPOSE_C_GENERAL);
log_fn(LOG_NOTICE,"Stream is %d seconds late on address '%s'. Retrying.", log_fn(LOG_NOTICE,"Stream is %d seconds late on address '%s'. Retrying.",
(int)(now - conn->timestamp_lastread), conn->socks_request->address); (int)(now - conn->timestamp_lastread), conn->socks_request->address);
circuit_log_path(LOG_WARN, circ); circuit_log_path(LOG_NOTICE, circ);
/* send an end down the circuit */ /* send an end down the circuit */
connection_edge_end(conn, END_STREAM_REASON_TIMEOUT, conn->cpath_layer); connection_edge_end(conn, END_STREAM_REASON_TIMEOUT, conn->cpath_layer);
/* un-mark it as ending, since we're going to reuse it */ /* un-mark it as ending, since we're going to reuse it */
@ -406,7 +406,7 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
} }
if (socks->command == SOCKS_COMMAND_CONNECT && socks->port == 0) { if (socks->command == SOCKS_COMMAND_CONNECT && socks->port == 0) {
log_fn(LOG_WARN,"Application asked to connect to port 0. Refusing."); log_fn(LOG_NOTICE,"Application asked to connect to port 0. Refusing.");
return -1; return -1;
} }
conn->state = AP_CONN_STATE_CIRCUIT_WAIT; conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
@ -958,7 +958,7 @@ connection_exit_connect(connection_t *conn) {
conn->state = EXIT_CONN_STATE_OPEN; conn->state = EXIT_CONN_STATE_OPEN;
if (connection_wants_to_flush(conn)) { /* in case there are any queued data cells */ if (connection_wants_to_flush(conn)) { /* in case there are any queued data cells */
log_fn(LOG_WARN,"tell roger: newly connected conn had data waiting!"); log_fn(LOG_WARN,"Bug: newly connected conn had data waiting!");
// connection_start_writing(conn); // connection_start_writing(conn);
} }
connection_watch_events(conn, POLLIN); connection_watch_events(conn, POLLIN);
@ -1066,7 +1066,7 @@ int socks_policy_permits_address(uint32_t addr)
else if (a==0) else if (a==0)
return 1; return 1;
tor_assert(a==1); tor_assert(a==1);
log_fn(LOG_WARN, "Got unexpected 'maybe' answer from socks policy"); log_fn(LOG_WARN, "Bug: Got unexpected 'maybe' answer from socks policy");
return 0; return 0;
} }

View File

@ -210,7 +210,7 @@ connection_t *connection_or_connect(uint32_t addr, uint16_t port,
if (server_mode(get_options()) && (me=router_get_my_routerinfo()) && if (server_mode(get_options()) && (me=router_get_my_routerinfo()) &&
!memcmp(me->identity_digest, id_digest,DIGEST_LEN)) { !memcmp(me->identity_digest, id_digest,DIGEST_LEN)) {
log_fn(LOG_WARN,"Request to connect to myself! Failing."); log_fn(LOG_WARN,"Bug: Request to connect to myself! Failing.");
return NULL; return NULL;
} }
@ -403,7 +403,7 @@ connection_tls_finish_handshake(connection_t *conn) {
if (connection_or_nonopen_was_started_here(conn)) { if (connection_or_nonopen_was_started_here(conn)) {
/* I initiated this connection. */ /* I initiated this connection. */
if (strcasecmp(conn->nickname, nickname)) { if (strcasecmp(conn->nickname, nickname)) {
log_fn(options->DirPort ? LOG_WARN : LOG_INFO, log_fn(authdir_mode(options) ? LOG_WARN : LOG_INFO,
"Other side (%s:%d) is '%s', but we tried to connect to '%s'", "Other side (%s:%d) is '%s', but we tried to connect to '%s'",
conn->address, conn->port, nickname, conn->nickname); conn->address, conn->port, nickname, conn->nickname);
control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED); control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED);

View File

@ -572,7 +572,7 @@ void
control_event_logmsg(int severity, const char *msg) control_event_logmsg(int severity, const char *msg)
{ {
size_t len; size_t len;
if (severity > LOG_WARN) /* Less important than warning? ignore for now. */ if (severity > LOG_NOTICE) /* Less important than notice? ignore for now. */
return; return;
if (!EVENT_IS_INTERESTING(EVENT_WARNING)) if (!EVENT_IS_INTERESTING(EVENT_WARNING))
return; return;

View File

@ -102,7 +102,7 @@ int dir_policy_permits_address(uint32_t addr)
else if (a==0) else if (a==0)
return 1; return 1;
tor_assert(a==1); tor_assert(a==1);
log_fn(LOG_WARN, "Got unexpected 'maybe' answer from dir policy"); log_fn(LOG_WARN, "Bug: got unexpected 'maybe' answer from dir policy");
return 0; return 0;
} }
@ -764,7 +764,7 @@ directory_handle_command_get(connection_t *conn, char *headers,
tor_free(url); tor_free(url);
if (dlen == 0) { if (dlen == 0) {
log_fn(LOG_WARN,"My directory is empty. Closing."); log_fn(LOG_NOTICE,"My directory is empty. Closing.");
connection_write_to_buf(answer503, strlen(answer503), conn); connection_write_to_buf(answer503, strlen(answer503), conn);
return 0; return 0;
} }
@ -967,7 +967,7 @@ int connection_dir_finished_flushing(connection_t *conn) {
connection_mark_for_close(conn); connection_mark_for_close(conn);
return 0; return 0;
default: default:
log_fn(LOG_WARN,"BUG: called in unexpected state %d.", conn->state); log_fn(LOG_WARN,"Bug: called in unexpected state %d.", conn->state);
return -1; return -1;
} }
return 0; return 0;

View File

@ -111,19 +111,19 @@ dirserv_parse_fingerprint_file(const char *fname)
for (list=front; list; list=list->next) { for (list=front; list; list=list->next) {
nickname = list->key; fingerprint = list->value; nickname = list->key; fingerprint = list->value;
if (strlen(nickname) > MAX_NICKNAME_LEN) { if (strlen(nickname) > MAX_NICKNAME_LEN) {
log(LOG_WARN, "Nickname '%s' too long in fingerprint file. Skipping.", nickname); log(LOG_NOTICE, "Nickname '%s' too long in fingerprint file. Skipping.", nickname);
continue; continue;
} }
if (strlen(fingerprint) != FINGERPRINT_LEN || if (strlen(fingerprint) != FINGERPRINT_LEN ||
!crypto_pk_check_fingerprint_syntax(fingerprint)) { !crypto_pk_check_fingerprint_syntax(fingerprint)) {
log_fn(LOG_WARN, "Invalid fingerprint (nickname '%s', fingerprint %s). Skipping.", log_fn(LOG_NOTICE, "Invalid fingerprint (nickname '%s', fingerprint %s). Skipping.",
nickname, fingerprint); nickname, fingerprint);
continue; continue;
} }
if (0==strcasecmp(nickname, DEFAULT_CLIENT_NICKNAME)) { if (0==strcasecmp(nickname, DEFAULT_CLIENT_NICKNAME)) {
/* If you approved an OR called "client", then clients who use /* If you approved an OR called "client", then clients who use
* the default nickname could all be rejected. That's no good. */ * the default nickname could all be rejected. That's no good. */
log(LOG_WARN, log(LOG_NOTICE,
"Authorizing a nickname '%s' would break many clients; skipping.", "Authorizing a nickname '%s' would break many clients; skipping.",
DEFAULT_CLIENT_NICKNAME); DEFAULT_CLIENT_NICKNAME);
continue; continue;
@ -131,7 +131,7 @@ dirserv_parse_fingerprint_file(const char *fname)
for (i = 0; i < smartlist_len(fingerprint_list_new); ++i) { for (i = 0; i < smartlist_len(fingerprint_list_new); ++i) {
ent = smartlist_get(fingerprint_list_new, i); ent = smartlist_get(fingerprint_list_new, i);
if (0==strcasecmp(ent->nickname, nickname)) { if (0==strcasecmp(ent->nickname, nickname)) {
log(LOG_WARN, "Duplicate nickname '%s'. Skipping.",nickname); log(LOG_NOTICE, "Duplicate nickname '%s'. Skipping.",nickname);
break; /* out of the for. the 'if' below means skip to the next line. */ break; /* out of the for. the 'if' below means skip to the next line. */
} }
} }
@ -352,13 +352,13 @@ dirserv_add_descriptor(const char **desc)
/* Is there too much clock skew? */ /* Is there too much clock skew? */
now = time(NULL); now = time(NULL);
if (ri->published_on > now+ROUTER_ALLOW_SKEW) { if (ri->published_on > now+ROUTER_ALLOW_SKEW) {
log_fn(LOG_WARN, "Publication time for nickname '%s' is too far in the future; possible clock skew. Not adding.", ri->nickname); log_fn(LOG_NOTICE, "Publication time for nickname '%s' is too far in the future; possible clock skew. Not adding.", ri->nickname);
routerinfo_free(ri); routerinfo_free(ri);
*desc = end; *desc = end;
return 0; return 0;
} }
if (ri->published_on < now-ROUTER_MAX_AGE) { if (ri->published_on < now-ROUTER_MAX_AGE) {
log_fn(LOG_WARN, "Publication time for router with nickname '%s' is too far in the past. Not adding.", ri->nickname); log_fn(LOG_NOTICE, "Publication time for router with nickname '%s' is too far in the past. Not adding.", ri->nickname);
routerinfo_free(ri); routerinfo_free(ri);
*desc = end; *desc = end;
return 0; return 0;
@ -737,7 +737,7 @@ void dirserv_set_cached_directory(const char *directory, time_t when,
char filename[512]; char filename[512];
tor_snprintf(filename,sizeof(filename),"%s/cached-directory", get_options()->DataDirectory); tor_snprintf(filename,sizeof(filename),"%s/cached-directory", get_options()->DataDirectory);
if (write_str_to_file(filename,cached_directory.dir,0) < 0) { if (write_str_to_file(filename,cached_directory.dir,0) < 0) {
log_fn(LOG_WARN, "Couldn't write cached directory to disk. Ignoring."); log_fn(LOG_NOTICE, "Couldn't write cached directory to disk. Ignoring.");
} }
} }
} }

View File

@ -117,7 +117,7 @@ static void purge_expired_resolves(uint32_t now) {
resolve = oldest_cached_resolve; resolve = oldest_cached_resolve;
log(LOG_DEBUG,"Forgetting old cached resolve (expires %lu)", (unsigned long)resolve->expire); log(LOG_DEBUG,"Forgetting old cached resolve (expires %lu)", (unsigned long)resolve->expire);
if (resolve->state == CACHE_STATE_PENDING) { if (resolve->state == CACHE_STATE_PENDING) {
log_fn(LOG_WARN,"Expiring a dns resolve that's still pending. Forgot to cull it?"); log_fn(LOG_WARN,"Bug: Expiring a dns resolve that's still pending. Forgot to cull it?");
} }
if (resolve->pending_connections) { if (resolve->pending_connections) {
log_fn(LOG_WARN, "Closing pending connections on expiring DNS resolve!"); log_fn(LOG_WARN, "Closing pending connections on expiring DNS resolve!");
@ -316,7 +316,7 @@ void connection_dns_remove(connection_t *conn)
resolve = SPLAY_FIND(cache_tree, &cache_root, &search); resolve = SPLAY_FIND(cache_tree, &cache_root, &search);
if (!resolve) { if (!resolve) {
log_fn(LOG_WARN,"Address '%s' is not pending. Dropping.", conn->address); log_fn(LOG_NOTICE,"Address '%s' is not pending. Dropping.", conn->address);
return; return;
} }
@ -392,7 +392,7 @@ void dns_cancel_pending_resolve(char *address) {
resolve = SPLAY_FIND(cache_tree, &cache_root, &search); resolve = SPLAY_FIND(cache_tree, &cache_root, &search);
if (!resolve) { if (!resolve) {
log_fn(LOG_WARN,"Address '%s' is not pending. Dropping.", address); log_fn(LOG_NOTICE,"Address '%s' is not pending. Dropping.", address);
return; return;
} }
@ -475,7 +475,7 @@ static void dns_found_answer(char *address, uint32_t addr, char outcome) {
if (resolve->state != CACHE_STATE_PENDING) { if (resolve->state != CACHE_STATE_PENDING) {
/* XXXX Maybe update addr? or check addr for consistency? Or let /* XXXX Maybe update addr? or check addr for consistency? Or let
* VALID replace FAILED? */ * VALID replace FAILED? */
log_fn(LOG_WARN, "Resolved '%s' which was already resolved; ignoring", log_fn(LOG_NOTICE, "Resolved '%s' which was already resolved; ignoring",
address); address);
tor_assert(resolve->pending_connections == NULL); tor_assert(resolve->pending_connections == NULL);
return; return;
@ -784,7 +784,7 @@ static void spawn_enough_dnsworkers(void) {
while (num_dnsworkers > num_dnsworkers_busy+MAX_IDLE_DNSWORKERS) { /* too many idle? */ while (num_dnsworkers > num_dnsworkers_busy+MAX_IDLE_DNSWORKERS) { /* too many idle? */
/* cull excess workers */ /* cull excess workers */
log_fn(LOG_WARN,"%d of %d dnsworkers are idle. Killing one.", log_fn(LOG_NOTICE,"%d of %d dnsworkers are idle. Killing one.",
num_dnsworkers-num_dnsworkers_needed, num_dnsworkers); num_dnsworkers-num_dnsworkers_needed, num_dnsworkers);
dnsconn = connection_get_by_type_state(CONN_TYPE_DNSWORKER, DNSWORKER_STATE_IDLE); dnsconn = connection_get_by_type_state(CONN_TYPE_DNSWORKER, DNSWORKER_STATE_IDLE);
tor_assert(dnsconn); tor_assert(dnsconn);

View File

@ -765,7 +765,7 @@ hibernate_end_time_elapsed(time_t now)
} }
} }
/** The big function. Consider our environment and decide if it's time /** Consider our environment and decide if it's time
* to start/stop hibernating. * to start/stop hibernating.
*/ */
void consider_hibernation(time_t now) { void consider_hibernation(time_t now) {

View File

@ -270,7 +270,7 @@ static void conn_read(int i) {
connection_handle_read(conn) < 0) { connection_handle_read(conn) < 0) {
if (!conn->marked_for_close) { if (!conn->marked_for_close) {
/* this connection is broken. remove it */ /* this connection is broken. remove it */
log_fn(LOG_WARN,"Unhandled error on read for %s connection (fd %d); removing", log_fn(LOG_WARN,"Bug: unhandled error on read for %s connection (fd %d); removing",
CONN_TYPE_TO_STRING(conn->type), conn->s); CONN_TYPE_TO_STRING(conn->type), conn->s);
connection_mark_for_close(conn); connection_mark_for_close(conn);
} }
@ -300,7 +300,7 @@ static void conn_write(int i) {
if (connection_handle_write(conn) < 0) { if (connection_handle_write(conn) < 0) {
if (!conn->marked_for_close) { if (!conn->marked_for_close) {
/* this connection is broken. remove it. */ /* this connection is broken. remove it. */
log_fn(LOG_WARN,"Unhandled error on write for %s connection (fd %d); removing", log_fn(LOG_WARN,"Bug: unhandled error on write for %s connection (fd %d); removing",
CONN_TYPE_TO_STRING(conn->type), conn->s); CONN_TYPE_TO_STRING(conn->type), conn->s);
conn->has_sent_end = 1; /* otherwise we cry wolf about duplicate close */ conn->has_sent_end = 1; /* otherwise we cry wolf about duplicate close */
/* XXX do we need a close-immediate here, so we don't try to flush? */ /* XXX do we need a close-immediate here, so we don't try to flush? */
@ -355,7 +355,7 @@ static void conn_close_if_marked(int i) {
return; return;
} }
if (connection_wants_to_flush(conn)) { if (connection_wants_to_flush(conn)) {
log_fn(LOG_WARN,"Conn (addr %s, fd %d, type %s, state %d) still wants to flush. Losing %d bytes! (Marked at %s:%d)", log_fn(LOG_NOTICE,"Conn (addr %s, fd %d, type %s, state %d) still wants to flush. Losing %d bytes! (Marked at %s:%d)",
conn->address, conn->s, CONN_TYPE_TO_STRING(conn->type), conn->state, conn->address, conn->s, CONN_TYPE_TO_STRING(conn->type), conn->state,
(int)buf_datalen(conn->outbuf), conn->marked_for_close_file, (int)buf_datalen(conn->outbuf), conn->marked_for_close_file,
conn->marked_for_close); conn->marked_for_close);
@ -563,6 +563,7 @@ static void run_scheduled_events(time_t now) {
if (tor_tls_context_new(get_identity_key(), 1, options->Nickname, if (tor_tls_context_new(get_identity_key(), 1, options->Nickname,
MAX_SSL_KEY_LIFETIME) < 0) { MAX_SSL_KEY_LIFETIME) < 0) {
log_fn(LOG_WARN, "Error reinitializing TLS context"); log_fn(LOG_WARN, "Error reinitializing TLS context");
/* XXX is it a bug here, that we just keep going? */
} }
last_rotated_certificate = now; last_rotated_certificate = now;
/* XXXX We should rotate TLS connections as well; this code doesn't change /* XXXX We should rotate TLS connections as well; this code doesn't change
@ -761,7 +762,7 @@ static int do_hup(void) {
tor_snprintf(keydir,sizeof(keydir),"%s/approved-routers", options->DataDirectory); tor_snprintf(keydir,sizeof(keydir),"%s/approved-routers", options->DataDirectory);
log_fn(LOG_INFO,"Reloading approved fingerprints from %s...",keydir); log_fn(LOG_INFO,"Reloading approved fingerprints from %s...",keydir);
if (dirserv_parse_fingerprint_file(keydir) < 0) { if (dirserv_parse_fingerprint_file(keydir) < 0) {
log_fn(LOG_WARN, "Error reloading fingerprints. Continuing with old list."); log_fn(LOG_NOTICE, "Error reloading fingerprints. Continuing with old list.");
} }
} }
/* Fetch a new directory. Even authdirservers do this. */ /* Fetch a new directory. Even authdirservers do this. */

View File

@ -46,7 +46,7 @@ int onion_pending_add(circuit_t *circ) {
tor_assert(!ol_tail->next); tor_assert(!ol_tail->next);
if (ol_length >= get_options()->MaxOnionsPending) { if (ol_length >= get_options()->MaxOnionsPending) {
log_fn(LOG_WARN,"Already have %d onions queued. Closing.", ol_length); log_fn(LOG_NOTICE,"Already have %d onions queued. Closing.", ol_length);
tor_free(tmp); tor_free(tmp);
return -1; return -1;
} }

View File

@ -525,7 +525,7 @@ connection_edge_process_relay_cell_not_open(
return 0; /* this circuit is screwed and doesn't know it yet */ return 0; /* this circuit is screwed and doesn't know it yet */
} }
if (connection_ap_can_use_exit(conn, exitrouter)) { if (connection_ap_can_use_exit(conn, exitrouter)) {
log_fn(LOG_WARN,"Exitrouter %s seems to be more restrictive than its exit policy. Not using this router as exit for now,", exitrouter->nickname); log_fn(LOG_NOTICE,"Exitrouter %s seems to be more restrictive than its exit policy. Not using this router as exit for now,", exitrouter->nickname);
addr_policy_free(exitrouter->exit_policy); addr_policy_free(exitrouter->exit_policy);
exitrouter->exit_policy = exitrouter->exit_policy =
router_parse_addr_policy_from_string("reject *:*"); router_parse_addr_policy_from_string("reject *:*");
@ -555,7 +555,7 @@ connection_edge_process_relay_cell_not_open(
/* else, conn will get closed below */ /* else, conn will get closed below */
log_fn(LOG_INFO,"Giving up on retrying (from resolvefailed); conn can't be handled."); log_fn(LOG_INFO,"Giving up on retrying (from resolvefailed); conn can't be handled.");
} else { } else {
log_fn(LOG_WARN,"Have tried resolving address %s at %d different places. Giving up.", log_fn(LOG_NOTICE,"Have tried resolving address %s at %d different places. Giving up.",
conn->socks_request->address, MAX_RESOLVE_FAILURES); conn->socks_request->address, MAX_RESOLVE_FAILURES);
} }
} }