diff options
author | Roger Dingledine <arma@torproject.org> | 2005-10-17 01:29:28 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2005-10-17 01:29:28 +0000 |
commit | ae92a91d96f1942a3607292304f02a4947f5202b (patch) | |
tree | 2cbd2ecbd2caaef7b1afab807117bdbe49b565ae | |
parent | 03dcef4c78b029f7345c69f7f5d59338198bf2e5 (diff) | |
download | tor-ae92a91d96f1942a3607292304f02a4947f5202b.tar.gz tor-ae92a91d96f1942a3607292304f02a4947f5202b.zip |
more log uncluttering
svn:r5254
-rw-r--r-- | src/or/circuitbuild.c | 12 | ||||
-rw-r--r-- | src/or/connection.c | 8 | ||||
-rw-r--r-- | src/or/connection_or.c | 7 | ||||
-rw-r--r-- | src/or/main.c | 2 | ||||
-rw-r--r-- | src/or/relay.c | 16 |
5 files changed, 28 insertions, 17 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index f1c5f1c2fb..420c9ba3bf 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -599,8 +599,9 @@ circuit_note_clock_jumped(int seconds_elapsed) } /** Take the 'extend' cell, pull out addr/port plus the onion skin. Make - * sure we're connected to the next hop, and pass it the onion skin in - * a create cell. + * sure we're connected to the next hop, and pass it the onion skin using + * a create cell. Return -1 if we want to warn and tear down the circuit, + * else return 0. */ int circuit_extend(cell_t *cell, circuit_t *circ) @@ -611,14 +612,14 @@ circuit_extend(cell_t *cell, circuit_t *circ) char *id_digest=NULL; if (circ->n_conn) { - log_fn(LOG_WARN,"n_conn already set. Bug/attack. Closing."); + log_fn(LOG_PROTOCOL_WARN,"n_conn already set. Bug/attack. Closing."); return -1; } relay_header_unpack(&rh, cell->payload); if (rh.length < 4+2+ONIONSKIN_CHALLENGE_LEN+DIGEST_LEN) { - log_fn(LOG_WARN, "Wrong length %d on extend cell. Closing circuit.", rh.length); + log_fn(LOG_PROTOCOL_WARN, "Wrong length %d on extend cell. Closing circuit.", rh.length); return -1; } @@ -654,7 +655,8 @@ circuit_extend(cell_t *cell, circuit_t *circ) n_conn = connection_or_connect(circ->n_addr, circ->n_port, id_digest); if (!n_conn) { log_fn(LOG_INFO,"Launching n_conn failed. Closing."); - return -1; + circuit_mark_for_close(circ); + return 0; } log_fn(LOG_DEBUG,"connecting in progress (or finished). Good."); } diff --git a/src/or/connection.c b/src/or/connection.c index 6875fe8f17..2e611ccc8a 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -458,7 +458,13 @@ connection_expire_held_open(void) if (conn->hold_open_until_flushed) { tor_assert(conn->marked_for_close); if (now - conn->timestamp_lastwritten >= 15) { - log_fn(LOG_NOTICE,"Giving up on marked_for_close conn that's been flushing for 15s (fd %d, type %s, state %s).", + int severity; + if (conn->type == CONN_TYPE_EXIT || + (conn->type == CONN_TYPE_DIR && conn->purpose == DIR_PURPOSE_SERVER)) + severity = LOG_INFO; + else + severity = LOG_NOTICE; + log_fn(severity, "Giving up on marked_for_close conn that's been flushing for 15s (fd %d, type %s, state %s).", conn->s, conn_type_to_string(conn->type), conn_state_to_string(conn->type, conn->state)); conn->hold_open_until_flushed = 0; diff --git a/src/or/connection_or.c b/src/or/connection_or.c index bf27ff71a1..65217cdc79 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -463,8 +463,7 @@ connection_or_check_valid_handshake(connection_t *conn, char *digest_rcvd) crypto_pk_env_t *identity_rcvd=NULL; char nickname[MAX_NICKNAME_LEN+1]; or_options_t *options = get_options(); - int severity = (authdir_mode(options) || !server_mode(options)) - ? LOG_WARN : LOG_INFO; + int severity = server_mode(options) ? LOG_PROTOCOL_WARN : LOG_WARN; check_no_tls_errors(); if (! tor_tls_peer_has_cert(conn->tls)) { @@ -473,7 +472,7 @@ connection_or_check_valid_handshake(connection_t *conn, char *digest_rcvd) } check_no_tls_errors(); if (tor_tls_get_peer_cert_nickname(conn->tls, nickname, sizeof(nickname))) { - log_fn(LOG_WARN,"Other side (%s:%d) has a cert without a valid nickname. Closing.", + log_fn(severity,"Other side (%s:%d) has a cert without a valid nickname. Closing.", conn->address, conn->port); return -1; } @@ -482,7 +481,7 @@ connection_or_check_valid_handshake(connection_t *conn, char *digest_rcvd) conn->address, conn->port, nickname); if (tor_tls_verify(severity, conn->tls, &identity_rcvd) < 0) { - log_fn(LOG_WARN,"Other side, which claims to be router '%s' (%s:%d), has a cert but it's invalid. Closing.", + log_fn(severity,"Other side, which claims to be router '%s' (%s:%d), has a cert but it's invalid. Closing.", nickname, conn->address, conn->port); return -1; } diff --git a/src/or/main.c b/src/or/main.c index d1105a0407..d24f7b0e04 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -619,7 +619,7 @@ run_connection_housekeeping(int i, time_t now) } else if ( now >= conn->timestamp_lastempty + options->KeepalivePeriod*10 && now >= conn->timestamp_lastwritten + options->KeepalivePeriod*10) { - log_fn(LOG_NOTICE,"Expiring stuck OR connection to fd %d (%s:%d). (%d bytes to flush; %d seconds since last write)", + log_fn(LOG_PROTOCOL_WARN,"Expiring stuck OR connection to fd %d (%s:%d). (%d bytes to flush; %d seconds since last write)", conn->s, conn->address, conn->port, (int)buf_datalen(conn->outbuf), (int)(now-conn->timestamp_lastwritten)); diff --git a/src/or/relay.c b/src/or/relay.c index f78eb1be08..4a6d7e5dfd 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -157,7 +157,7 @@ circuit_receive_relay_cell(cell_t *cell, circuit_t *circ, int cell_direction) ++stats_n_relay_cells_delivered; log_fn(LOG_DEBUG,"Sending away from origin."); if (connection_edge_process_relay_cell(cell, circ, conn, NULL) < 0) { - log_fn(LOG_WARN,"connection_edge_process_relay_cell (away from origin) failed."); + log_fn(LOG_PROTOCOL_WARN,"connection_edge_process_relay_cell (away from origin) failed."); return -1; } } @@ -808,7 +808,7 @@ connection_edge_process_relay_cell_not_open( * If <b>layer_hint</b> is defined, then we're the origin of the * circuit, and it specifies the hop that packaged <b>cell</b>. * - * Return -1 if you want to tear down the circuit, else 0. + * Return -1 if you want to warn and tear down the circuit, else 0. */ static int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, @@ -858,8 +858,10 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, ++stats_n_data_cells_received; if (( layer_hint && --layer_hint->deliver_window < 0) || (!layer_hint && --circ->deliver_window < 0)) { - log_fn(LOG_WARN,"(relay data) circ deliver_window below 0. Killing."); - connection_edge_end(conn, END_STREAM_REASON_TORPROTOCOL, conn->cpath_layer); + log_fn(LOG_PROTOCOL_WARN, + "(relay data) circ deliver_window below 0. Killing."); + connection_edge_end(conn, END_STREAM_REASON_TORPROTOCOL, + conn->cpath_layer); connection_mark_for_close(conn); return -1; } @@ -874,7 +876,8 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, } if (--conn->deliver_window < 0) { /* is it below 0 after decrement? */ - log_fn(LOG_WARN,"(relay data) conn deliver_window below 0. Killing."); + log_fn(LOG_PROTOCOL_WARN, + "(relay data) conn deliver_window below 0. Killing."); return -1; /* somebody's breaking protocol. kill the whole circuit. */ } @@ -962,7 +965,8 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, return 0; case RELAY_COMMAND_CONNECTED: if (conn) { - log_fn(LOG_WARN,"'connected' unsupported while open. Closing circ."); + log_fn(LOG_PROTOCOL_WARN, + "'connected' unsupported while open. Closing circ."); return -1; } log_fn(LOG_INFO,"'connected' received, no conn attached anymore. Ignoring."); |