aboutsummaryrefslogtreecommitdiff
path: root/src/or/relay.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-02-13 10:33:00 +0000
committerRoger Dingledine <arma@torproject.org>2006-02-13 10:33:00 +0000
commit259c65ab08a4a88e310097cd5df155d62ea22447 (patch)
treedf8c85eeb34952fc4590d37770d15b69d58aaaf9 /src/or/relay.c
parentaa63a84fe10a32c33dac183517e8c41b7494a128 (diff)
downloadtor-259c65ab08a4a88e310097cd5df155d62ea22447.tar
tor-259c65ab08a4a88e310097cd5df155d62ea22447.tar.gz
the last of the log convention conversion. finally.
svn:r6005
Diffstat (limited to 'src/or/relay.c')
-rw-r--r--src/or/relay.c232
1 files changed, 123 insertions, 109 deletions
diff --git a/src/or/relay.c b/src/or/relay.c
index 1c308f1f5..8dbe4acc1 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -123,7 +123,7 @@ relay_crypt_one_payload(crypto_cipher_env_t *cipher, char *in,
r = crypto_cipher_decrypt(cipher, out, in, CELL_PAYLOAD_SIZE);
if (r) {
- warn(LD_BUG,"Error during relay encryption");
+ log_warn(LD_BUG,"Error during relay encryption");
return -1;
}
memcpy(in,out,CELL_PAYLOAD_SIZE);
@@ -157,7 +157,7 @@ circuit_receive_relay_cell(cell_t *cell, circuit_t *circ, int cell_direction)
return 0;
if (relay_crypt(circ, cell, cell_direction, &layer_hint, &recognized) < 0) {
- warn(LD_BUG,"relay crypt failed. Dropping connection.");
+ log_warn(LD_BUG,"relay crypt failed. Dropping connection.");
return -1;
}
@@ -165,7 +165,7 @@ circuit_receive_relay_cell(cell_t *cell, circuit_t *circ, int cell_direction)
conn = relay_lookup_conn(circ, cell, cell_direction);
if (cell_direction == CELL_DIRECTION_OUT) {
++stats_n_relay_cells_delivered;
- debug(LD_OR,"Sending away from origin.");
+ log_debug(LD_OR,"Sending away from origin.");
if ((reason=connection_edge_process_relay_cell(cell, circ, conn, NULL))
< 0) {
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
@@ -176,10 +176,11 @@ circuit_receive_relay_cell(cell_t *cell, circuit_t *circ, int cell_direction)
}
if (cell_direction == CELL_DIRECTION_IN) {
++stats_n_relay_cells_delivered;
- debug(LD_OR,"Sending to origin.");
+ log_debug(LD_OR,"Sending to origin.");
if ((reason = connection_edge_process_relay_cell(cell, circ, conn,
layer_hint)) < 0) {
- warn(LD_OR,"connection_edge_process_relay_cell (at origin) failed.");
+ log_warn(LD_OR,
+ "connection_edge_process_relay_cell (at origin) failed.");
return reason;
}
}
@@ -203,8 +204,8 @@ circuit_receive_relay_cell(cell_t *cell, circuit_t *circ, int cell_direction)
cell->circ_id = circ->rend_splice->p_circ_id;
if ((reason = circuit_receive_relay_cell(cell, circ->rend_splice,
CELL_DIRECTION_IN)) < 0) {
- warn(LD_REND, "Error relaying cell across rendezvous; closing "
- "circuits");
+ log_warn(LD_REND, "Error relaying cell across rendezvous; closing "
+ "circuits");
/* XXXX Do this here, or just return -1? */
circuit_mark_for_close(circ, -reason);
return reason;
@@ -216,7 +217,7 @@ circuit_receive_relay_cell(cell_t *cell, circuit_t *circ, int cell_direction)
return -END_CIRC_REASON_TORPROTOCOL;
}
- debug(LD_OR,"Passing on unrecognized cell.");
+ log_debug(LD_OR,"Passing on unrecognized cell.");
++stats_n_relay_cells_relayed;
connection_or_write_cell_to_buf(cell, conn);
return 0;
@@ -281,7 +282,7 @@ relay_crypt(circuit_t *circ, cell_t *cell, int cell_direction,
thishop = thishop->next;
} while (thishop != circ->cpath && thishop->state == CPATH_STATE_OPEN);
- warn(LD_OR,"in-cell at OP not recognized. Closing.");
+ log_warn(LD_OR,"in-cell at OP not recognized. Closing.");
return -1;
} else { /* we're in the middle. Just one crypt. */
if (relay_crypt_one_payload(circ->p_crypto, cell->payload, 1) < 0)
@@ -322,7 +323,7 @@ circuit_package_relay_cell(cell_t *cell, circuit_t *circ,
if (cell_direction == CELL_DIRECTION_OUT) {
conn = circ->n_conn;
if (!conn) {
- warn(LD_BUG,"outgoing relay cell has n_conn==NULL. Dropping.");
+ log_warn(LD_BUG,"outgoing relay cell has n_conn==NULL. Dropping.");
return 0; /* just drop it */
}
relay_set_digest(layer_hint->f_digest, cell);
@@ -332,7 +333,7 @@ circuit_package_relay_cell(cell_t *cell, circuit_t *circ,
do {
tor_assert(thishop);
/* XXXX RD This is a bug, right? */
- debug(LD_OR,"crypting a layer of the relay cell.");
+ log_debug(LD_OR,"crypting a layer of the relay cell.");
if (relay_crypt_one_payload(thishop->f_crypto, cell->payload, 1) < 0) {
return -1;
}
@@ -344,7 +345,7 @@ circuit_package_relay_cell(cell_t *cell, circuit_t *circ,
conn = circ->p_conn;
if (!conn) {
/* XXXX RD This is a bug, right? */
- warn(LD_BUG,"incoming relay cell has p_conn==NULL. Dropping.");
+ log_warn(LD_BUG,"incoming relay cell has p_conn==NULL. Dropping.");
assert_circuit_ok(circ);
return 0; /* just drop it */
}
@@ -377,7 +378,7 @@ relay_lookup_conn(circuit_t *circ, cell_t *cell, int cell_direction)
for (tmpconn = circ->n_streams; tmpconn; tmpconn=tmpconn->next_stream) {
if (rh.stream_id == tmpconn->stream_id && !tmpconn->marked_for_close) {
- debug(LD_EXIT,"found conn for stream %d.", rh.stream_id);
+ log_debug(LD_EXIT,"found conn for stream %d.", rh.stream_id);
if (cell_direction == CELL_DIRECTION_OUT ||
connection_edge_is_rendezvous_stream(tmpconn))
return tmpconn;
@@ -385,14 +386,14 @@ relay_lookup_conn(circuit_t *circ, cell_t *cell, int cell_direction)
}
for (tmpconn = circ->p_streams; tmpconn; tmpconn=tmpconn->next_stream) {
if (rh.stream_id == tmpconn->stream_id && !tmpconn->marked_for_close) {
- debug(LD_APP,"found conn for stream %d.", rh.stream_id);
+ log_debug(LD_APP,"found conn for stream %d.", rh.stream_id);
return tmpconn;
}
}
for (tmpconn = circ->resolving_streams; tmpconn;
tmpconn=tmpconn->next_stream) {
if (rh.stream_id == tmpconn->stream_id && !tmpconn->marked_for_close) {
- debug(LD_EXIT,"found conn for stream %d.", rh.stream_id);
+ log_debug(LD_EXIT,"found conn for stream %d.", rh.stream_id);
return tmpconn;
}
}
@@ -447,19 +448,19 @@ connection_edge_send_command(connection_t *fromconn, circuit_t *circ,
int cell_direction;
if (fromconn && fromconn->marked_for_close) {
- warn(LD_BUG,
- "Bug: called on conn that's already marked for close at %s:%d.",
- fromconn->marked_for_close_file, fromconn->marked_for_close);
+ log_warn(LD_BUG,
+ "Bug: called on conn that's already marked for close at %s:%d.",
+ fromconn->marked_for_close_file, fromconn->marked_for_close);
return 0;
}
if (!circ) {
tor_assert(fromconn);
if (fromconn->type == CONN_TYPE_AP) {
- info(LD_APP,"no circ. Closing conn.");
+ log_info(LD_APP,"no circ. Closing conn.");
connection_mark_unattached_ap(fromconn, END_STREAM_REASON_INTERNAL);
} else {
- info(LD_EXIT,"no circ. Closing conn.");
+ log_info(LD_EXIT,"no circ. Closing conn.");
fromconn->has_sent_end = 1; /* no circ to send to */
connection_mark_for_close(fromconn);
}
@@ -487,12 +488,12 @@ connection_edge_send_command(connection_t *fromconn, circuit_t *circ,
memcpy(cell.payload+RELAY_HEADER_SIZE, payload, payload_len);
}
- debug(LD_OR,"delivering %d cell %s.", relay_command,
- cell_direction == CELL_DIRECTION_OUT ? "forward" : "backward");
+ log_debug(LD_OR,"delivering %d cell %s.", relay_command,
+ cell_direction == CELL_DIRECTION_OUT ? "forward" : "backward");
if (circuit_package_relay_cell(&cell, circ, cell_direction, cpath_layer)
< 0) {
- warn(LD_BUG,"circuit_package_relay_cell failed. Closing.");
+ log_warn(LD_BUG,"circuit_package_relay_cell failed. Closing.");
circuit_mark_for_close(circ, END_CIRC_REASON_INTERNAL);
return -1;
}
@@ -508,8 +509,8 @@ connection_edge_end_reason_str(int reason)
{
switch (reason) {
case -1:
- warn(LD_PROTOCOL,
- "End cell arrived with length 0. Should be at least 1.");
+ log_warn(LD_PROTOCOL,
+ "End cell arrived with length 0. Should be at least 1.");
return "MALFORMED";
case END_STREAM_REASON_MISC: return "misc error";
case END_STREAM_REASON_RESOLVEFAILED: return "resolve failed";
@@ -524,7 +525,7 @@ connection_edge_end_reason_str(int reason)
case END_STREAM_REASON_CONNRESET: return "connection reset";
case END_STREAM_REASON_TORPROTOCOL: return "Tor protocol error";
default:
- warn(LD_PROTOCOL,"Reason for ending (%d) not recognized.",reason);
+ log_warn(LD_PROTOCOL,"Reason for ending (%d) not recognized.",reason);
return "unknown";
}
}
@@ -568,7 +569,7 @@ connection_edge_end_reason_socks5_response(int reason)
case END_STREAM_REASON_NET_UNREACHABLE:
return SOCKS5_NET_UNREACHABLE;
default:
- warn(LD_PROTOCOL,"Reason for ending (%d) not recognized.",reason);
+ log_warn(LD_PROTOCOL,"Reason for ending (%d) not recognized.",reason);
return SOCKS5_GENERAL_ERROR;
}
}
@@ -618,9 +619,9 @@ errno_to_end_reason(int e)
E_CASE(EMFILE):
return END_STREAM_REASON_RESOURCELIMIT;
default:
- info(LD_EXIT, "Didn't recognize errno %d (%s); telling the OP that "
- "we are ending a stream for 'misc' reason.",
- e, tor_socket_strerror(e));
+ log_info(LD_EXIT, "Didn't recognize errno %d (%s); telling the OP that "
+ "we are ending a stream for 'misc' reason.",
+ e, tor_socket_strerror(e));
return END_STREAM_REASON_MISC;
}
}
@@ -656,9 +657,9 @@ connection_edge_process_end_not_open(
if (rh->length > 0 && edge_reason_is_retriable(reason) &&
conn->type == CONN_TYPE_AP) {
- info(LD_APP,"Address '%s' refused due to '%s'. Considering retrying.",
- safe_str(conn->socks_request->address),
- connection_edge_end_reason_str(reason));
+ log_info(LD_APP,"Address '%s' refused due to '%s'. Considering retrying.",
+ safe_str(conn->socks_request->address),
+ connection_edge_end_reason_str(reason));
exitrouter =
router_get_by_digest(circ->build_state->chosen_exit->identity_digest);
switch (reason) {
@@ -667,8 +668,8 @@ connection_edge_process_end_not_open(
uint32_t addr = ntohl(get_uint32(cell->payload+RELAY_HEADER_SIZE+1));
int ttl;
if (!addr) {
- info(LD_APP,"Address '%s' resolved to 0.0.0.0. Closing,",
- safe_str(conn->socks_request->address));
+ log_info(LD_APP,"Address '%s' resolved to 0.0.0.0. Closing,",
+ safe_str(conn->socks_request->address));
connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
return 0;
}
@@ -684,7 +685,7 @@ connection_edge_process_end_not_open(
(rh->length < 5 ||
(tor_inet_aton(conn->socks_request->address, &in) &&
!conn->chosen_exit_name))) {
- notice(LD_APP,
+ log_notice(LD_APP,
"Exitrouter '%s' seems to be more restrictive than its exit "
"policy. Not using this router as exit for now.",
exitrouter->nickname);
@@ -712,9 +713,11 @@ connection_edge_process_end_not_open(
return 0;
/* else, conn will get closed below */
} else {
- notice(LD_APP,"Have tried resolving or connecting to address '%s' "
- "at %d different places. Giving up.",
- safe_str(conn->socks_request->address), MAX_RESOLVE_FAILURES);
+ log_notice(LD_APP,
+ "Have tried resolving or connecting to address '%s' "
+ "at %d different places. Giving up.",
+ safe_str(conn->socks_request->address),
+ MAX_RESOLVE_FAILURES);
/* clear the failures, so it will have a full try next time */
client_dns_clear_failures(conn->socks_request->address);
}
@@ -731,10 +734,11 @@ connection_edge_process_end_not_open(
/* else, will close below */
break;
} /* end switch */
- info(LD_APP,"Giving up on retrying; conn can't be handled.");
+ log_info(LD_APP,"Giving up on retrying; conn can't be handled.");
}
- info(LD_APP,"Edge got end (%s) before we're connected. Marking for close.",
+ log_info(LD_APP,
+ "Edge got end (%s) before we're connected. Marking for close.",
connection_edge_end_reason_str(rh->length > 0 ? reason : -1));
if (conn->type == CONN_TYPE_AP) {
circuit_log_path(LOG_INFO,LD_APP,circ);
@@ -764,19 +768,20 @@ connection_edge_process_relay_cell_not_open(
if (conn->type == CONN_TYPE_AP && rh->command == RELAY_COMMAND_CONNECTED) {
if (conn->state != AP_CONN_STATE_CONNECT_WAIT) {
- warn(LD_APP,"Got 'connected' while not in state connect_wait. "
- "Dropping.");
+ log_warn(LD_APP,"Got 'connected' while not in state connect_wait. "
+ "Dropping.");
return 0;
}
// log_fn(LOG_INFO,"Connected! Notifying application.");
conn->state = AP_CONN_STATE_OPEN;
- info(LD_APP,"'connected' received after %d seconds.",
- (int)(time(NULL) - conn->timestamp_lastread));
+ log_info(LD_APP,"'connected' received after %d seconds.",
+ (int)(time(NULL) - conn->timestamp_lastread));
if (rh->length >= 4) {
uint32_t addr = ntohl(get_uint32(cell->payload+RELAY_HEADER_SIZE));
int ttl;
if (!addr) {
- info(LD_APP,"...but it claims the IP address was 0.0.0.0. Closing.");
+ log_info(LD_APP,
+ "...but it claims the IP address was 0.0.0.0. Closing.");
connection_edge_end(conn, END_STREAM_REASON_TORPROTOCOL,
conn->cpath_layer);
connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
@@ -803,14 +808,14 @@ connection_edge_process_relay_cell_not_open(
int ttl;
int answer_len;
if (conn->state != AP_CONN_STATE_RESOLVE_WAIT) {
- warn(LD_APP,"Got a 'resolved' cell while not in state resolve_wait. "
- "Dropping.");
+ log_warn(LD_APP,"Got a 'resolved' cell while not in state resolve_wait. "
+ "Dropping.");
return 0;
}
tor_assert(conn->socks_request->command == SOCKS_COMMAND_RESOLVE);
answer_len = cell->payload[RELAY_HEADER_SIZE+1];
if (rh->length < 2 || answer_len+2>rh->length) {
- warn(LD_PROTOCOL, "Dropping malformed 'resolved' cell");
+ log_warn(LD_PROTOCOL, "Dropping malformed 'resolved' cell");
connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
return 0;
}
@@ -865,10 +870,11 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
relay_header_unpack(&rh, cell->payload);
// log_fn(LOG_DEBUG,"command %d stream %d", rh.command, rh.stream_id);
num_seen++;
- debug(domain, "Now seen %d relay cells here.", num_seen);
+ log_debug(domain, "Now seen %d relay cells here.", num_seen);
if (rh.length > RELAY_PAYLOAD_SIZE) {
- warn(LD_PROTOCOL, "Relay cell length field too long. Closing circuit.");
+ log_warn(LD_PROTOCOL,
+ "Relay cell length field too long. Closing circuit.");
return - END_CIRC_REASON_TORPROTOCOL;
}
@@ -881,16 +887,16 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
switch (rh.command) {
case RELAY_COMMAND_DROP:
- info(domain,"Got a relay-level padding cell. Dropping.");
+ log_info(domain,"Got a relay-level padding cell. Dropping.");
return 0;
case RELAY_COMMAND_BEGIN:
if (layer_hint &&
circ->purpose != CIRCUIT_PURPOSE_S_REND_JOINED) {
- warn(LD_APP,"relay begin request unsupported at AP. Dropping.");
+ log_warn(LD_APP,"relay begin request unsupported at AP. Dropping.");
return 0;
}
if (conn) {
- warn(domain,"begin cell for known stream. Dropping.");
+ log_warn(domain,"begin cell for known stream. Dropping.");
return 0;
}
connection_exit_begin_conn(cell, circ);
@@ -906,13 +912,13 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
connection_mark_for_close(conn);
return -END_CIRC_REASON_TORPROTOCOL;
}
- debug(domain,"circ deliver_window now %d.", layer_hint ?
- layer_hint->deliver_window : circ->deliver_window);
+ log_debug(domain,"circ deliver_window now %d.", layer_hint ?
+ layer_hint->deliver_window : circ->deliver_window);
circuit_consider_sending_sendme(circ, layer_hint);
if (!conn) {
- info(domain,"data cell dropped, unknown stream.");
+ log_info(domain,"data cell dropped, unknown stream.");
return 0;
}
@@ -929,19 +935,20 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return 0;
case RELAY_COMMAND_END:
if (!conn) {
- info(domain,"end cell (%s) dropped, unknown stream.",
- connection_edge_end_reason_str(rh.length > 0 ?
- *(char *)(cell->payload+RELAY_HEADER_SIZE) : -1));
+ log_info(domain,"end cell (%s) dropped, unknown stream.",
+ connection_edge_end_reason_str(rh.length > 0 ?
+ *(char *)(cell->payload+RELAY_HEADER_SIZE) : -1));
return 0;
}
/* XXX add to this log_fn the exit node's nickname? */
- info(domain,"%d: end cell (%s) for stream %d. Removing stream.",
- conn->s,
- connection_edge_end_reason_str(rh.length > 0 ?
- *(char *)(cell->payload+RELAY_HEADER_SIZE) : -1),
- conn->stream_id);
+ log_info(domain,"%d: end cell (%s) for stream %d. Removing stream.",
+ conn->s,
+ connection_edge_end_reason_str(rh.length > 0 ?
+ *(char *)(cell->payload+RELAY_HEADER_SIZE) : -1),
+ conn->stream_id);
if (conn->socks_request && !conn->socks_request->has_finished)
- warn(LD_BUG,"Bug: open stream hasn't sent socks answer yet? Closing.");
+ log_warn(LD_BUG,
+ "Bug: open stream hasn't sent socks answer yet? Closing.");
#ifdef HALF_OPEN
conn->done_sending = 1;
shutdown(conn->s, 1); /* XXX check return; refactor NM */
@@ -964,29 +971,30 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return 0;
case RELAY_COMMAND_EXTEND:
if (conn) {
- warn(domain,"'extend' for non-zero stream. Dropping.");
+ log_warn(domain,"'extend' for non-zero stream. Dropping.");
return 0;
}
return circuit_extend(cell, circ);
case RELAY_COMMAND_EXTENDED:
if (!layer_hint) {
- warn(LD_PROTOCOL,"'extended' unsupported at non-origin. Dropping.");
+ log_warn(LD_PROTOCOL,
+ "'extended' unsupported at non-origin. Dropping.");
return 0;
}
- debug(domain,"Got an extended cell! Yay.");
+ log_debug(domain,"Got an extended cell! Yay.");
if ((reason = circuit_finish_handshake(circ, CELL_CREATED,
cell->payload+RELAY_HEADER_SIZE)) < 0) {
- warn(domain,"circuit_finish_handshake failed.");
+ log_warn(domain,"circuit_finish_handshake failed.");
return reason;
}
if ((reason=circuit_send_next_onion_skin(circ))<0) {
- info(domain,"circuit_send_next_onion_skin() failed.");
+ log_info(domain,"circuit_send_next_onion_skin() failed.");
return reason;
}
return 0;
case RELAY_COMMAND_TRUNCATE:
if (layer_hint) {
- warn(LD_APP,"'truncate' unsupported at origin. Dropping.");
+ log_warn(LD_APP,"'truncate' unsupported at origin. Dropping.");
return 0;
}
if (circ->n_conn) {
@@ -994,7 +1002,7 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
connection_or_send_destroy(circ->n_circ_id, circ->n_conn, reason);
circuit_set_circid_orconn(circ, 0, NULL, N_CONN_CHANGED);
}
- debug(LD_EXIT, "Processed 'truncate', replying.");
+ log_debug(LD_EXIT, "Processed 'truncate', replying.");
{
char payload[1];
payload[0] = (char)END_CIRC_REASON_REQUESTED;
@@ -1004,7 +1012,7 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return 0;
case RELAY_COMMAND_TRUNCATED:
if (!layer_hint) {
- warn(LD_EXIT,"'truncated' unsupported at non-origin. Dropping.");
+ log_warn(LD_EXIT,"'truncated' unsupported at non-origin. Dropping.");
return 0;
}
circuit_truncated(circ, layer_hint);
@@ -1015,26 +1023,28 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
"'connected' unsupported while open. Closing circ.");
return -END_CIRC_REASON_TORPROTOCOL;
}
- info(domain,"'connected' received, no conn attached anymore. Ignoring.");
+ log_info(domain,
+ "'connected' received, no conn attached anymore. Ignoring.");
return 0;
case RELAY_COMMAND_SENDME:
if (!conn) {
if (layer_hint) {
layer_hint->package_window += CIRCWINDOW_INCREMENT;
- debug(LD_APP,"circ-level sendme at origin, packagewindow %d.",
- layer_hint->package_window);
+ log_debug(LD_APP,"circ-level sendme at origin, packagewindow %d.",
+ layer_hint->package_window);
circuit_resume_edge_reading(circ, layer_hint);
} else {
circ->package_window += CIRCWINDOW_INCREMENT;
- debug(LD_APP,"circ-level sendme at non-origin, packagewindow %d.",
- circ->package_window);
+ log_debug(LD_APP,
+ "circ-level sendme at non-origin, packagewindow %d.",
+ circ->package_window);
circuit_resume_edge_reading(circ, layer_hint);
}
return 0;
}
conn->package_window += STREAMWINDOW_INCREMENT;
- debug(domain,"stream-level sendme, packagewindow now %d.",
- conn->package_window);
+ log_debug(domain,"stream-level sendme, packagewindow now %d.",
+ conn->package_window);
connection_start_reading(conn);
/* handle whatever might still be on the inbuf */
if (connection_edge_package_raw_inbuf(conn, 1) < 0) {
@@ -1045,24 +1055,25 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return 0;
case RELAY_COMMAND_RESOLVE:
if (layer_hint) {
- warn(LD_APP,"resolve request unsupported at AP; dropping.");
+ log_warn(LD_APP,"resolve request unsupported at AP; dropping.");
return 0;
} else if (conn) {
- warn(domain, "resolve request for known stream; dropping.");
+ log_warn(domain, "resolve request for known stream; dropping.");
return 0;
} else if (circ->purpose != CIRCUIT_PURPOSE_OR) {
- warn(domain, "resolve request on circ with purpose %d; dropping",
- circ->purpose);
+ log_warn(domain, "resolve request on circ with purpose %d; dropping",
+ circ->purpose);
return 0;
}
connection_exit_begin_resolve(cell, circ);
return 0;
case RELAY_COMMAND_RESOLVED:
if (conn) {
- warn(domain,"'resolved' unsupported while open. Closing circ.");
+ log_warn(domain,"'resolved' unsupported while open. Closing circ.");
return -END_CIRC_REASON_TORPROTOCOL;
}
- info(domain,"'resolved' received, no conn attached anymore. Ignoring.");
+ log_info(domain,
+ "'resolved' received, no conn attached anymore. Ignoring.");
return 0;
case RELAY_COMMAND_ESTABLISH_INTRO:
case RELAY_COMMAND_ESTABLISH_RENDEZVOUS:
@@ -1107,9 +1118,9 @@ connection_edge_package_raw_inbuf(connection_t *conn, int package_partial)
tor_assert(conn);
tor_assert(!connection_speaks_cells(conn));
if (conn->marked_for_close) {
- warn(LD_BUG,
- "Bug: called on conn that's already marked for close at %s:%d.",
- conn->marked_for_close_file, conn->marked_for_close);
+ log_warn(LD_BUG,
+ "Bug: called on conn that's already marked for close at %s:%d.",
+ conn->marked_for_close_file, conn->marked_for_close);
return 0;
}
@@ -1117,7 +1128,7 @@ repeat_connection_edge_package_raw_inbuf:
circ = circuit_get_by_edge_conn(conn);
if (!circ) {
- info(domain,"conn has no circuit! Closing.");
+ log_info(domain,"conn has no circuit! Closing.");
return -1;
}
@@ -1125,8 +1136,8 @@ repeat_connection_edge_package_raw_inbuf:
return 0;
if (conn->package_window <= 0) {
- info(domain,"called with package_window %d. Skipping.",
- conn->package_window);
+ log_info(domain,"called with package_window %d. Skipping.",
+ conn->package_window);
connection_stop_reading(conn);
return 0;
}
@@ -1149,8 +1160,8 @@ repeat_connection_edge_package_raw_inbuf:
connection_fetch_from_buf(payload, length, conn);
- debug(domain,"(%d) Packaging %d bytes (%d waiting).", conn->s,
- (int)length, (int)buf_datalen(conn->inbuf));
+ log_debug(domain,"(%d) Packaging %d bytes (%d waiting).", conn->s,
+ (int)length, (int)buf_datalen(conn->inbuf));
if (connection_edge_send_command(conn, circ, RELAY_COMMAND_DATA,
payload, length, conn->cpath_layer) < 0)
@@ -1167,11 +1178,11 @@ repeat_connection_edge_package_raw_inbuf:
if (--conn->package_window <= 0) { /* is it 0 after decrement? */
connection_stop_reading(conn);
- debug(domain,"conn->package_window reached 0.");
+ log_debug(domain,"conn->package_window reached 0.");
circuit_consider_stop_edge_reading(circ, conn->cpath_layer);
return 0; /* don't process the inbuf any more */
}
- debug(domain,"conn->package_window is now %d",conn->package_window);
+ log_debug(domain,"conn->package_window is now %d",conn->package_window);
/* handle more if there's more, or return 0 if there isn't */
goto repeat_connection_edge_package_raw_inbuf;
@@ -1195,17 +1206,18 @@ connection_edge_consider_sending_sendme(connection_t *conn)
if (!circ) {
/* this can legitimately happen if the destroy has already
* arrived and torn down the circuit */
- info(LD_APP,"No circuit associated with conn. Skipping.");
+ log_info(LD_APP,"No circuit associated with conn. Skipping.");
return;
}
while (conn->deliver_window < STREAMWINDOW_START - STREAMWINDOW_INCREMENT) {
- debug(conn->cpath_layer?LD_APP:LD_EXIT,
- "Outbuf %d, Queueing stream sendme.", (int)conn->outbuf_flushlen);
+ log_debug(conn->cpath_layer?LD_APP:LD_EXIT,
+ "Outbuf %d, Queueing stream sendme.",
+ (int)conn->outbuf_flushlen);
conn->deliver_window += STREAMWINDOW_INCREMENT;
if (connection_edge_send_command(conn, circ, RELAY_COMMAND_SENDME,
NULL, 0, conn->cpath_layer) < 0) {
- warn(LD_APP,"connection_edge_send_command failed. Returning.");
+ log_warn(LD_APP,"connection_edge_send_command failed. Returning.");
return; /* the circuit's closed, don't continue */
}
}
@@ -1220,7 +1232,7 @@ static void
circuit_resume_edge_reading(circuit_t *circ, crypt_path_t *layer_hint)
{
- debug(layer_hint?LD_APP:LD_EXIT,"resuming");
+ log_debug(layer_hint?LD_APP:LD_EXIT,"resuming");
/* have to check both n_streams and p_streams, to handle rendezvous */
if (circuit_resume_edge_reading_helper(circ->n_streams, circ, layer_hint)
@@ -1274,9 +1286,10 @@ circuit_consider_stop_edge_reading(circuit_t *circ, crypt_path_t *layer_hint)
unsigned domain = layer_hint ? LD_APP : LD_EXIT;
if (!layer_hint) {
- debug(domain,"considering circ->package_window %d", circ->package_window);
+ log_debug(domain,"considering circ->package_window %d",
+ circ->package_window);
if (circ->package_window <= 0) {
- debug(domain,"yes, not-at-origin. stopped.");
+ log_debug(domain,"yes, not-at-origin. stopped.");
for (conn = circ->n_streams; conn; conn=conn->next_stream)
connection_stop_reading(conn);
return 1;
@@ -1284,10 +1297,10 @@ circuit_consider_stop_edge_reading(circuit_t *circ, crypt_path_t *layer_hint)
return 0;
}
/* else, layer hint is defined, use it */
- debug(domain,"considering layer_hint->package_window %d",
- layer_hint->package_window);
+ log_debug(domain,"considering layer_hint->package_window %d",
+ layer_hint->package_window);
if (layer_hint->package_window <= 0) {
- debug(domain,"yes, at-origin. stopped.");
+ log_debug(domain,"yes, at-origin. stopped.");
for (conn = circ->n_streams; conn; conn=conn->next_stream)
if (conn->cpath_layer == layer_hint)
connection_stop_reading(conn);
@@ -1312,14 +1325,15 @@ circuit_consider_sending_sendme(circuit_t *circ, crypt_path_t *layer_hint)
// layer_hint ? "defined" : "null");
while ((layer_hint ? layer_hint->deliver_window : circ->deliver_window) <
CIRCWINDOW_START - CIRCWINDOW_INCREMENT) {
- debug(LD_CIRC,"Queueing circuit sendme.");
+ log_debug(LD_CIRC,"Queueing circuit sendme.");
if (layer_hint)
layer_hint->deliver_window += CIRCWINDOW_INCREMENT;
else
circ->deliver_window += CIRCWINDOW_INCREMENT;
if (connection_edge_send_command(NULL, circ, RELAY_COMMAND_SENDME,
NULL, 0, layer_hint) < 0) {
- warn(LD_CIRC,"connection_edge_send_command failed. Circuit's closed.");
+ log_warn(LD_CIRC,
+ "connection_edge_send_command failed. Circuit's closed.");
return; /* the circuit's closed, don't continue */
}
}