[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r9900: Eliminate more redundant circuit_t arguments when edge_conne (in tor/trunk: . src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r9900: Eliminate more redundant circuit_t arguments when edge_conne (in tor/trunk: . src/or)
- From: nickm@xxxxxxxx
- Date: Sat, 24 Mar 2007 11:58:12 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Sat, 24 Mar 2007 11:58:20 -0400
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: nickm
Date: 2007-03-24 11:58:11 -0400 (Sat, 24 Mar 2007)
New Revision: 9900
Modified:
tor/trunk/
tor/trunk/src/or/circuituse.c
tor/trunk/src/or/command.c
tor/trunk/src/or/connection_edge.c
tor/trunk/src/or/dns.c
tor/trunk/src/or/or.h
tor/trunk/src/or/relay.c
tor/trunk/src/or/rendmid.c
Log:
r12644@0-41-wifi: nickm | 2007-03-23 16:02:23 -0400
Eliminate more redundant circuit_t arguments when edge_connection_t is already supplied and the circuit is already attached.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r12644] on c95137ef-5f19-0410-b913-86e773d04f59
Modified: tor/trunk/src/or/circuituse.c
===================================================================
--- tor/trunk/src/or/circuituse.c 2007-03-24 15:57:51 UTC (rev 9899)
+++ tor/trunk/src/or/circuituse.c 2007-03-24 15:58:11 UTC (rev 9900)
@@ -1183,11 +1183,11 @@
consider_recording_trackhost(conn, circ);
/* fall through */
case SOCKS_COMMAND_CONNECT_DIR:
- if (connection_ap_handshake_send_begin(conn, circ)<0)
+ if (connection_ap_handshake_send_begin(conn)<0)
return -1;
break;
default:
- if (connection_ap_handshake_send_resolve(conn, circ)<0)
+ if (connection_ap_handshake_send_resolve(conn)<0)
return -1;
}
@@ -1286,7 +1286,7 @@
*/
rendcirc->_base.timestamp_dirty = time(NULL);
link_apconn_to_circ(conn, rendcirc);
- if (connection_ap_handshake_send_begin(conn, rendcirc) < 0)
+ if (connection_ap_handshake_send_begin(conn) < 0)
return 0; /* already marked, let them fade away */
return 1;
}
Modified: tor/trunk/src/or/command.c
===================================================================
--- tor/trunk/src/or/command.c 2007-03-24 15:57:51 UTC (rev 9899)
+++ tor/trunk/src/or/command.c 2007-03-24 15:58:11 UTC (rev 9900)
@@ -291,8 +291,9 @@
} else { /* pack it into an extended relay cell, and send it. */
log_debug(LD_OR,
"Converting created cell to extended relay cell, sending.");
- connection_edge_send_command(NULL, circ, RELAY_COMMAND_EXTENDED,
- cell->payload, ONIONSKIN_REPLY_LEN);
+ relay_send_command_from_edge(0, circ, RELAY_COMMAND_EXTENDED,
+ cell->payload, ONIONSKIN_REPLY_LEN,
+ NULL);
}
}
@@ -383,8 +384,8 @@
char payload[1];
log_debug(LD_OR, "Delivering 'truncated' back.");
payload[0] = (char)reason;
- connection_edge_send_command(NULL, circ, RELAY_COMMAND_TRUNCATED,
- payload, sizeof(payload));
+ relay_send_command_from_edge(0, circ, RELAY_COMMAND_TRUNCATED,
+ payload, sizeof(payload), NULL);
}
}
}
Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c 2007-03-24 15:57:51 UTC (rev 9899)
+++ tor/trunk/src/or/connection_edge.c 2007-03-24 15:58:11 UTC (rev 9900)
@@ -211,7 +211,7 @@
circ = circuit_get_by_edge_conn(conn);
if (circ && !circ->marked_for_close) {
log_debug(LD_EDGE,"Sending end on conn (fd %d).",conn->_base.s);
- connection_edge_send_command(conn, circ, RELAY_COMMAND_END,
+ connection_edge_send_command(conn, RELAY_COMMAND_END,
payload, payload_len);
} else {
log_debug(LD_EDGE,"No circ to send end on conn (fd %d).",
@@ -301,7 +301,6 @@
/* deliver a 'connected' relay cell back through the circuit. */
if (connection_edge_is_rendezvous_stream(edge_conn)) {
if (connection_edge_send_command(edge_conn,
- circuit_get_by_edge_conn(edge_conn),
RELAY_COMMAND_CONNECTED, NULL, 0) < 0)
return 0; /* circuit is closed, don't continue */
} else {
@@ -310,7 +309,6 @@
set_uint32(connected_payload+4,
htonl(dns_clip_ttl(edge_conn->address_ttl)));
if (connection_edge_send_command(edge_conn,
- circuit_get_by_edge_conn(edge_conn),
RELAY_COMMAND_CONNECTED,
connected_payload, 8) < 0)
return 0; /* circuit is closed, don't continue */
@@ -1740,12 +1738,14 @@
* If ap_conn is broken, mark it for close and return -1. Else return 0.
*/
int
-connection_ap_handshake_send_begin(edge_connection_t *ap_conn,
- origin_circuit_t *circ)
+connection_ap_handshake_send_begin(edge_connection_t *ap_conn)
{
char payload[CELL_PAYLOAD_SIZE];
int payload_len;
int begin_type;
+ origin_circuit_t *circ;
+ tor_assert(ap_conn->on_circuit);
+ circ = TO_ORIGIN_CIRCUIT(ap_conn->on_circuit);
tor_assert(ap_conn->_base.type == CONN_TYPE_AP);
tor_assert(ap_conn->_base.state == AP_CONN_STATE_CIRCUIT_WAIT);
@@ -1774,7 +1774,7 @@
tor_assert(circ->build_state->onehop_tunnel == 0);
}
- if (connection_edge_send_command(ap_conn, TO_CIRCUIT(circ), begin_type,
+ if (connection_edge_send_command(ap_conn, begin_type,
begin_type == RELAY_COMMAND_BEGIN ? payload : NULL,
begin_type == RELAY_COMMAND_BEGIN ? payload_len : 0) < 0)
return -1; /* circuit is closed, don't continue */
@@ -1794,12 +1794,14 @@
* If ap_conn is broken, mark it for close and return -1. Else return 0.
*/
int
-connection_ap_handshake_send_resolve(edge_connection_t *ap_conn,
- origin_circuit_t *circ)
+connection_ap_handshake_send_resolve(edge_connection_t *ap_conn)
{
int payload_len, command;
const char *string_addr;
char inaddr_buf[32];
+ origin_circuit_t *circ;
+ tor_assert(ap_conn->on_circuit);
+ circ = TO_ORIGIN_CIRCUIT(ap_conn->on_circuit);
tor_assert(ap_conn->_base.type == CONN_TYPE_AP);
tor_assert(ap_conn->_base.state == AP_CONN_STATE_CIRCUIT_WAIT);
@@ -1841,7 +1843,7 @@
log_debug(LD_APP,
"Sending relay cell to begin stream %d.", ap_conn->stream_id);
- if (connection_edge_send_command(ap_conn, TO_CIRCUIT(circ),
+ if (connection_edge_send_command(ap_conn,
RELAY_COMMAND_RESOLVE,
string_addr, payload_len) < 0)
return -1; /* circuit is closed, don't continue */
@@ -2238,13 +2240,14 @@
return connection_exit_connect_dir(n_stream);
}
+ TO_OR_CIRCUIT(circ)->n_streams = n_stream; n_stream->on_circuit = circ;
+
/* send it off to the gethostbyname farm */
- switch (dns_resolve(n_stream, NULL)) {
+ switch (dns_resolve(n_stream)) {
case 1: /* resolve worked */
/* add it into the linked list of n_streams on this circuit */
n_stream->next_stream = TO_OR_CIRCUIT(circ)->n_streams;
- n_stream->on_circuit = circ;
TO_OR_CIRCUIT(circ)->n_streams = n_stream;
assert_circuit_ok(circ);
@@ -2255,12 +2258,11 @@
end_payload[0] = END_STREAM_REASON_RESOLVEFAILED;
relay_send_command_from_edge(rh.stream_id, circ, RELAY_COMMAND_END,
end_payload, 1, NULL);
- /* n_stream got freed. don't touch it. */
+ /* n_stream got detached and freed. don't touch it. */
break;
case 0: /* resolve added to pending list */
/* add it into the linked list of resolving_streams on this circuit */
n_stream->next_stream = TO_OR_CIRCUIT(circ)->resolving_streams;
- n_stream->on_circuit = circ;
TO_OR_CIRCUIT(circ)->resolving_streams = n_stream;
assert_circuit_ok(circ);
;
@@ -2296,8 +2298,10 @@
dummy_conn->_base.state = EXIT_CONN_STATE_RESOLVEFAILED;
dummy_conn->_base.purpose = EXIT_PURPOSE_RESOLVE;
+ dummy_conn->on_circuit = TO_CIRCUIT(circ);
+
/* send it off to the gethostbyname farm */
- switch (dns_resolve(dummy_conn, circ)) {
+ switch (dns_resolve(dummy_conn)) {
case -1: /* Impossible to resolve; a resolved cell was sent. */
/* Connection freed; don't touch it. */
return 0;
@@ -2307,7 +2311,6 @@
return 0;
case 0: /* resolve added to pending list */
dummy_conn->next_stream = circ->resolving_streams;
- dummy_conn->on_circuit = TO_CIRCUIT(circ);
circ->resolving_streams = dummy_conn;
assert_circuit_ok(TO_CIRCUIT(circ));
break;
@@ -2392,7 +2395,6 @@
/* rendezvous stream */
/* don't send an address back! */
connection_edge_send_command(edge_conn,
- circuit_get_by_edge_conn(edge_conn),
RELAY_COMMAND_CONNECTED,
NULL, 0);
} else { /* normal stream */
@@ -2402,7 +2404,6 @@
set_uint32(connected_payload+4,
htonl(dns_clip_ttl(edge_conn->address_ttl)));
connection_edge_send_command(edge_conn,
- circuit_get_by_edge_conn(edge_conn),
RELAY_COMMAND_CONNECTED,
connected_payload, 8);
}
@@ -2475,7 +2476,6 @@
connection_start_reading(TO_CONN(exit_conn));
if (connection_edge_send_command(exit_conn,
- circuit_get_by_edge_conn(exit_conn),
RELAY_COMMAND_CONNECTED, NULL, 0) < 0) {
connection_mark_for_close(TO_CONN(exit_conn));
connection_mark_for_close(TO_CONN(dir_conn));
Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c 2007-03-24 15:57:51 UTC (rev 9899)
+++ tor/trunk/src/or/dns.c 2007-03-24 15:58:11 UTC (rev 9900)
@@ -92,9 +92,8 @@
static void dns_found_answer(const char *address, int is_reverse,
uint32_t addr, const char *hostname, char outcome,
uint32_t ttl);
-static void send_resolved_cell(edge_connection_t *conn, or_circuit_t *circ,
- uint8_t answer_type);
-static int launch_resolve(edge_connection_t *exitconn, or_circuit_t *circ);
+static void send_resolved_cell(edge_connection_t *conn, uint8_t answer_type);
+static int launch_resolve(edge_connection_t *exitconn);
static void add_wildcarded_test_address(const char *address);
static int configure_nameservers(int force);
static int answer_is_wildcarded(const char *ip);
@@ -389,8 +388,7 @@
* <b>conn</b>'s attached circuit.
*/
static void
-send_resolved_cell(edge_connection_t *conn, or_circuit_t *circ,
- uint8_t answer_type)
+send_resolved_cell(edge_connection_t *conn, uint8_t answer_type)
{
char buf[RELAY_PAYLOAD_SIZE];
size_t buflen;
@@ -425,14 +423,7 @@
}
// log_notice(LD_EXIT, "Sending a regular RESOLVED reply: ");
- if (!circ) {
- circuit_t *tmp = circuit_get_by_edge_conn(conn);
- if (! CIRCUIT_IS_ORIGIN(tmp))
- circ = TO_OR_CIRCUIT(tmp);
- }
-
- connection_edge_send_command(conn, TO_CIRCUIT(circ),
- RELAY_COMMAND_RESOLVED, buf, buflen);
+ connection_edge_send_command(conn, RELAY_COMMAND_RESOLVED, buf, buflen);
}
/** Send a response to the RESOLVE request of a connection for an in-addr.arpa
@@ -444,8 +435,7 @@
* <b>conn</b>'s attached circuit.
*/
static void
-send_resolved_hostname_cell(edge_connection_t *conn, or_circuit_t *circ,
- const char *hostname)
+send_resolved_hostname_cell(edge_connection_t *conn, const char *hostname)
{
char buf[RELAY_PAYLOAD_SIZE];
size_t buflen;
@@ -462,15 +452,8 @@
set_uint32(buf+2+namelen, htonl(ttl));
buflen = 2+namelen+4;
- if (!circ) {
- circuit_t *tmp = circuit_get_by_edge_conn(conn);
- if (! CIRCUIT_IS_ORIGIN(tmp))
- circ = TO_OR_CIRCUIT(tmp);
- }
-
// log_notice(LD_EXIT, "Sending a reply RESOLVED reply: %s", hostname);
- connection_edge_send_command(conn, TO_CIRCUIT(circ),
- RELAY_COMMAND_RESOLVED, buf, buflen);
+ connection_edge_send_command(conn, RELAY_COMMAND_RESOLVED, buf, buflen);
// log_notice(LD_EXIT, "Sent");
}
@@ -525,9 +508,8 @@
* need to send back an END cell, since connection_exit_begin_conn will
* do that for us.)
*
- * If <b>oncirc</b> is provided, and this is a resolve request, we have
- * a cached answer, send the answer back along oncirc; otherwise, send
- * the answer back along <b>exitconn</b>'s attached circuit.
+ * If we have a cached answer, send the answer back along <b>exitconn</b>'s
+ * attached circuit.
*
* Else, if seen before and pending, add conn to the pending list,
* and return 0.
@@ -536,18 +518,17 @@
* dns farm, and return 0.
*/
int
-dns_resolve(edge_connection_t *exitconn, or_circuit_t *oncirc)
+dns_resolve(edge_connection_t *exitconn)
{
cached_resolve_t *resolve;
cached_resolve_t search;
pending_connection_t *pending_connection;
- circuit_t *circ;
struct in_addr in;
time_t now = time(NULL);
int is_reverse = 0, is_resolve, r;
+ or_circuit_t *oncirc = TO_OR_CIRCUIT(exitconn->on_circuit);
assert_connection_ok(TO_CONN(exitconn), 0);
tor_assert(exitconn->_base.s == -1);
-
assert_cache_ok();
is_resolve = exitconn->_base.purpose == EXIT_PURPOSE_RESOLVE;
@@ -558,7 +539,7 @@
exitconn->_base.addr = ntohl(in.s_addr);
exitconn->address_ttl = DEFAULT_DNS_TTL;
if (is_resolve)
- send_resolved_cell(exitconn, oncirc, RESOLVED_TYPE_IPV4);
+ send_resolved_cell(exitconn, RESOLVED_TYPE_IPV4);
return 1;
}
if (address_is_invalid_destination(exitconn->_base.address, 0)) {
@@ -566,10 +547,8 @@
"Rejecting invalid destination address %s",
escaped_safe_str(exitconn->_base.address));
if (is_resolve)
- send_resolved_cell(exitconn, oncirc, RESOLVED_TYPE_ERROR);
- circ = circuit_get_by_edge_conn(exitconn);
- if (circ)
- circuit_detach_stream(circ, exitconn);
+ send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR);
+ circuit_detach_stream(TO_CIRCUIT(oncirc), exitconn);
if (!exitconn->_base.marked_for_close)
connection_free(TO_CONN(exitconn));
return -1;
@@ -601,10 +580,8 @@
escaped_safe_str(exitconn->_base.address));
if (exitconn->_base.purpose == EXIT_PURPOSE_RESOLVE)
- send_resolved_cell(exitconn, oncirc, RESOLVED_TYPE_ERROR);
- circ = circuit_get_by_edge_conn(exitconn);
- if (circ)
- circuit_detach_stream(circ, exitconn);
+ send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR);
+ circuit_detach_stream(TO_CIRCUIT(oncirc), exitconn);
if (!exitconn->_base.marked_for_close)
connection_free(TO_CONN(exitconn));
return -1;
@@ -637,12 +614,12 @@
exitconn->address_ttl = resolve->ttl;
if (resolve->is_reverse) {
tor_assert(is_resolve);
- send_resolved_hostname_cell(exitconn, oncirc,
+ send_resolved_hostname_cell(exitconn,
resolve->result.hostname);
} else {
exitconn->_base.addr = resolve->result.addr;
if (is_resolve)
- send_resolved_cell(exitconn, oncirc, RESOLVED_TYPE_IPV4);
+ send_resolved_cell(exitconn, RESOLVED_TYPE_IPV4);
}
return 1;
case CACHE_STATE_CACHED_FAILED:
@@ -650,10 +627,8 @@
exitconn->_base.s,
escaped_safe_str(exitconn->_base.address));
if (is_resolve)
- send_resolved_cell(exitconn, oncirc, RESOLVED_TYPE_ERROR);
- circ = circuit_get_by_edge_conn(exitconn);
- if (circ)
- circuit_detach_stream(circ, exitconn);
+ send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR);
+ circuit_detach_stream(TO_CIRCUIT(oncirc), exitconn);
if (!exitconn->_base.marked_for_close)
connection_free(TO_CONN(exitconn));
return -1;
@@ -683,7 +658,7 @@
log_debug(LD_EXIT,"Launching %s.",
escaped_safe_str(exitconn->_base.address));
assert_cache_ok();
- return launch_resolve(exitconn, oncirc);
+ return launch_resolve(exitconn);
}
/** Log an error and abort if conn is waiting for a DNS resolve.
@@ -953,7 +928,7 @@
/* This detach must happen after we send the end cell. */
circuit_detach_stream(circuit_get_by_edge_conn(pendconn), pendconn);
} else {
- send_resolved_cell(pendconn, NULL, RESOLVED_TYPE_ERROR);
+ send_resolved_cell(pendconn, RESOLVED_TYPE_ERROR);
/* This detach must happen after we send the resolved cell. */
circuit_detach_stream(circuit_get_by_edge_conn(pendconn), pendconn);
}
@@ -980,9 +955,9 @@
* but it does the right thing. */
pendconn->_base.state = EXIT_CONN_STATE_RESOLVEFAILED;
if (is_reverse)
- send_resolved_hostname_cell(pendconn, NULL, hostname);
+ send_resolved_hostname_cell(pendconn, hostname);
else
- send_resolved_cell(pendconn, NULL, RESOLVED_TYPE_IPV4);
+ send_resolved_cell(pendconn, RESOLVED_TYPE_IPV4);
circ = circuit_get_by_edge_conn(pendconn);
tor_assert(circ);
circuit_detach_stream(circ, pendconn);
@@ -1187,7 +1162,7 @@
/** For eventdns: start resolving as necessary to find the target for
* <b>exitconn</b> */
static int
-launch_resolve(edge_connection_t *exitconn, or_circuit_t *circ)
+launch_resolve(edge_connection_t *exitconn)
{
char *addr = tor_strdup(exitconn->_base.address);
struct in_addr in;
@@ -1222,10 +1197,10 @@
escaped_safe_str(addr), r);
if (exitconn->_base.purpose == EXIT_PURPOSE_RESOLVE) {
if (evdns_err_is_transient(r))
- send_resolved_cell(exitconn, circ, RESOLVED_TYPE_ERROR_TRANSIENT);
+ send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR_TRANSIENT);
else {
exitconn->address_ttl = DEFAULT_DNS_TTL;
- send_resolved_cell(exitconn, circ, RESOLVED_TYPE_ERROR);
+ send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR);
}
}
dns_cancel_pending_resolve(addr); /* also sends end and frees */
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2007-03-24 15:57:51 UTC (rev 9899)
+++ tor/trunk/src/or/or.h 2007-03-24 15:58:11 UTC (rev 9900)
@@ -2195,10 +2195,8 @@
int connection_edge_finished_flushing(edge_connection_t *conn);
int connection_edge_finished_connecting(edge_connection_t *conn);
-int connection_ap_handshake_send_begin(edge_connection_t *ap_conn,
- origin_circuit_t *circ);
-int connection_ap_handshake_send_resolve(edge_connection_t *ap_conn,
- origin_circuit_t *circ);
+int connection_ap_handshake_send_begin(edge_connection_t *ap_conn);
+int connection_ap_handshake_send_resolve(edge_connection_t *ap_conn);
int connection_ap_make_bridge(char *address, uint16_t port,
const char *digest, int command);
@@ -2477,7 +2475,7 @@
void assert_connection_edge_not_dns_pending(edge_connection_t *conn);
void assert_all_pending_dns_resolves_ok(void);
void dns_cancel_pending_resolve(const char *question);
-int dns_resolve(edge_connection_t *exitconn, or_circuit_t *circ);
+int dns_resolve(edge_connection_t *exitconn);
void dns_launch_correctness_checks(void);
int dns_seems_to_be_broken(void);
void dns_reset_correctness_checks(void);
@@ -2619,7 +2617,7 @@
int relay_send_command_from_edge(uint16_t stream_id, circuit_t *circ,
int relay_command, const char *payload,
size_t payload_len, crypt_path_t *cpath_layer);
-int connection_edge_send_command(edge_connection_t *fromconn, circuit_t *circ,
+int connection_edge_send_command(edge_connection_t *fromconn,
int relay_command, const char *payload,
size_t payload_len);
int connection_edge_package_raw_inbuf(edge_connection_t *conn,
Modified: tor/trunk/src/or/relay.c
===================================================================
--- tor/trunk/src/or/relay.c 2007-03-24 15:57:51 UTC (rev 9899)
+++ tor/trunk/src/or/relay.c 2007-03-24 15:58:11 UTC (rev 9900)
@@ -512,14 +512,18 @@
* return -1. Else return 0.
*/
int
-connection_edge_send_command(edge_connection_t *fromconn, circuit_t *circ,
+connection_edge_send_command(edge_connection_t *fromconn,
int relay_command, const char *payload,
size_t payload_len)
{
/* XXXX NM Split this function into a separate versions per circuit type? */
- crypt_path_t *cpath_layer = fromconn ? fromconn->cpath_layer : NULL;
+ crypt_path_t *cpath_layer;
+ circuit_t *circ;
+ tor_assert(fromconn);
+ cpath_layer = fromconn ? fromconn->cpath_layer : NULL;
+ circ = fromconn->on_circuit;
- if (fromconn && fromconn->_base.marked_for_close) {
+ if (fromconn->_base.marked_for_close) {
log_warn(LD_BUG,
"called on conn that's already marked for close at %s:%d.",
fromconn->_base.marked_for_close_file,
@@ -528,7 +532,6 @@
}
if (!circ) {
- tor_assert(fromconn);
if (fromconn->_base.type == CONN_TYPE_AP) {
log_info(LD_APP,"no circ. Closing conn.");
connection_mark_unattached_ap(fromconn, END_STREAM_REASON_INTERNAL);
@@ -541,9 +544,9 @@
return -1;
}
- return relay_send_command_from_edge(fromconn ? fromconn->stream_id : 0,
- circ, relay_command, payload,
- payload_len, cpath_layer);
+ return relay_send_command_from_edge(fromconn->stream_id, circ,
+ relay_command, payload,
+ payload_len, fromconn->cpath_layer);
}
/** Translate <b>reason</b>, which came from a relay 'end' cell,
@@ -1114,8 +1117,8 @@
{
char payload[1];
payload[0] = (char)END_CIRC_REASON_REQUESTED;
- connection_edge_send_command(NULL, circ, RELAY_COMMAND_TRUNCATED,
- payload, sizeof(payload));
+ relay_send_command_from_edge(0, circ, RELAY_COMMAND_TRUNCATED,
+ payload, sizeof(payload), NULL);
}
return 0;
case RELAY_COMMAND_TRUNCATED:
@@ -1277,7 +1280,7 @@
log_debug(domain,"(%d) Packaging %d bytes (%d waiting).", conn->_base.s,
(int)length, (int)buf_datalen(conn->_base.inbuf));
- if (connection_edge_send_command(conn, circ, RELAY_COMMAND_DATA,
+ if (connection_edge_send_command(conn, RELAY_COMMAND_DATA,
payload, length) < 0 )
/* circuit got marked for close, don't continue, don't need to mark conn */
return 0;
@@ -1329,7 +1332,7 @@
"Outbuf %d, Queueing stream sendme.",
(int)conn->_base.outbuf_flushlen);
conn->deliver_window += STREAMWINDOW_INCREMENT;
- if (connection_edge_send_command(conn, circ, RELAY_COMMAND_SENDME,
+ if (connection_edge_send_command(conn, RELAY_COMMAND_SENDME,
NULL, 0) < 0) {
log_warn(LD_APP,"connection_edge_send_command failed. Returning.");
return; /* the circuit's closed, don't continue */
Modified: tor/trunk/src/or/rendmid.c
===================================================================
--- tor/trunk/src/or/rendmid.c 2007-03-24 15:57:51 UTC (rev 9899)
+++ tor/trunk/src/or/rendmid.c 2007-03-24 15:58:11 UTC (rev 9900)
@@ -96,9 +96,9 @@
}
/* Acknowledge the request. */
- if (connection_edge_send_command(NULL,TO_CIRCUIT(circ),
+ if (relay_send_command_from_edge(0, TO_CIRCUIT(circ),
RELAY_COMMAND_INTRO_ESTABLISHED,
- "", 0)<0) {
+ "", 0, NULL)<0) {
log_info(LD_GENERAL, "Couldn't send INTRO_ESTABLISHED cell.");
goto err;
}
@@ -170,17 +170,17 @@
intro_circ->p_circ_id);
/* Great. Now we just relay the cell down the circuit. */
- if (connection_edge_send_command(NULL, TO_CIRCUIT(intro_circ),
+ if (relay_send_command_from_edge(0, TO_CIRCUIT(intro_circ),
RELAY_COMMAND_INTRODUCE2,
- request, request_len)) {
+ request, request_len, NULL)) {
log_warn(LD_GENERAL,
"Unable to send INTRODUCE2 cell to Tor client.");
goto err;
}
/* And sent an ack down Alice's circuit. Empty body means succeeded. */
- if (connection_edge_send_command(NULL,TO_CIRCUIT(circ),
+ if (relay_send_command_from_edge(0,TO_CIRCUIT(circ),
RELAY_COMMAND_INTRODUCE_ACK,
- NULL,0)) {
+ NULL,0,NULL)) {
log_warn(LD_GENERAL, "Unable to send INTRODUCE_ACK cell to Tor client.");
circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_INTERNAL);
return -1;
@@ -190,9 +190,9 @@
err:
/* Send the client an NACK */
nak_body[0] = 1;
- if (connection_edge_send_command(NULL,TO_CIRCUIT(circ),
+ if (relay_send_command_from_edge(0,TO_CIRCUIT(circ),
RELAY_COMMAND_INTRODUCE_ACK,
- nak_body, 1)) {
+ nak_body, 1, NULL)) {
log_warn(LD_GENERAL, "Unable to send NAK to Tor client.");
/* Is this right? */
circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_INTERNAL);
@@ -228,9 +228,9 @@
}
/* Acknowledge the request. */
- if (connection_edge_send_command(NULL,TO_CIRCUIT(circ),
+ if (relay_send_command_from_edge(0,TO_CIRCUIT(circ),
RELAY_COMMAND_RENDEZVOUS_ESTABLISHED,
- "", 0)<0) {
+ "", 0, NULL)<0) {
log_warn(LD_PROTOCOL, "Couldn't send RENDEZVOUS_ESTABLISHED cell.");
reason = END_CIRC_REASON_INTERNAL;
goto err;
@@ -296,10 +296,10 @@
}
/* Send the RENDEZVOUS2 cell to Alice. */
- if (connection_edge_send_command(NULL, TO_CIRCUIT(rend_circ),
+ if (relay_send_command_from_edge(0, TO_CIRCUIT(rend_circ),
RELAY_COMMAND_RENDEZVOUS2,
request+REND_COOKIE_LEN,
- request_len-REND_COOKIE_LEN)) {
+ request_len-REND_COOKIE_LEN, NULL)) {
log_warn(LD_GENERAL,
"Unable to send RENDEZVOUS2 cell to client on circuit %d.",
rend_circ->p_circ_id);