aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-02-27 23:23:33 +0000
committerRoger Dingledine <arma@torproject.org>2004-02-27 23:23:33 +0000
commit611f117ce1bfd8ed39be622f394e925bc13b8252 (patch)
tree687de53819e90e9f044c072d1b7df67faf683f33
parentc5bbb571d2a27d0b81bfe7a1d374ba965497f267 (diff)
downloadtor-611f117ce1bfd8ed39be622f394e925bc13b8252.tar
tor-611f117ce1bfd8ed39be622f394e925bc13b8252.tar.gz
patches/answers to nick's commit
svn:r1146
-rw-r--r--src/or/circuit.c2
-rw-r--r--src/or/connection.c7
-rw-r--r--src/or/connection_edge.c8
-rw-r--r--src/or/main.c5
4 files changed, 13 insertions, 9 deletions
diff --git a/src/or/circuit.c b/src/or/circuit.c
index f0729b9f1..ab83827f1 100644
--- a/src/or/circuit.c
+++ b/src/or/circuit.c
@@ -64,8 +64,6 @@ circuit_t *circuit_new(uint16_t p_circ_id, connection_t *p_conn) {
circ->timestamp_created = time(NULL);
- circ->marked_for_close = 0;
-
circ->p_circ_id = p_circ_id;
circ->p_conn = p_conn;
diff --git a/src/or/connection.c b/src/or/connection.c
index 5917c0a57..134836c44 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -350,10 +350,11 @@ int connection_connect(connection_t *conn, char *address, uint32_t addr, uint16_
}
static void listener_close_if_present(int type) {
+ connection_t *conn;
assert(type == CONN_TYPE_OR_LISTENER ||
type == CONN_TYPE_AP_LISTENER ||
type == CONN_TYPE_DIR_LISTENER);
- connection_t *conn = connection_get_by_type(type);
+ conn = connection_get_by_type(type);
if (conn) {
close(conn->s);
conn->s = -1;
@@ -736,10 +737,6 @@ int connection_send_destroy(uint16_t circ_id, connection_t *conn) {
if(!connection_speaks_cells(conn)) {
log_fn(LOG_INFO,"CircID %d: At an edge. Marking connection for close.",
circ_id);
- if(conn->type == CONN_TYPE_EXIT && conn->state == EXIT_CONN_STATE_RESOLVING) {
- log_fn(LOG_INFO,"...and informing resolver we don't want the answer anymore.");
- dns_cancel_pending_resolve(conn->address, conn);
- }
connection_mark_for_close(conn, END_STREAM_REASON_DESTROY);
return 0;
}
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 157591fad..a2189b70a 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -535,6 +535,10 @@ void connection_ap_expire_beginning(void) {
if(connection_ap_handshake_attach_circuit(conn)<0) {
/* it will never work */
conn->has_sent_end = 1; /* Don't need to send end -- why? */
+/* XXX you're right, there's a bug. we should send an end cell
+ * above, right before circuit_detach_stream. But if attach_circuit()
+ * fails, then in fact we should mark without sending an end, because
+ * we're not connected to anything. -RD */
connection_mark_for_close(conn, 0);
}
}
@@ -557,7 +561,8 @@ void connection_ap_attach_pending(void)
continue;
if(connection_ap_handshake_attach_circuit(conn) < 0) {
/* it will never work */
- conn->has_sent_end = 1; /* why? */
+ conn->has_sent_end = 1; /* because there is no 'other end' of the stream */
+/* (XXX maybe has_sent_end should be called no_need_to_send_end or something) */
connection_mark_for_close(conn,0);
}
}
@@ -723,6 +728,7 @@ static void connection_ap_handshake_send_begin(connection_t *ap_conn, circuit_t
ap_conn->stream_id = get_unique_stream_id_by_circ(circ);
if (ap_conn->stream_id==0) {
+ ap_conn->has_sent_end = 1; /* there is no 'other side' yet */
connection_mark_for_close(ap_conn, 0);
return;
}
diff --git a/src/or/main.c b/src/or/main.c
index e68c2fe7d..c53d83d14 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -273,6 +273,9 @@ static void run_connection_housekeeping(int i, time_t now) {
log_fn(LOG_INFO,"Expiring connection to %d (%s:%d).",
i,conn->address, conn->port);
connection_mark_for_close(conn,0); /* Suppress end ??? */
+/* XXX there's no concept of 'suppressing end' here, because it's an OR
+ * connection, and there's no such thing as an end cell for an OR
+ * connection. -RD */
} else {
/* either a full router, or we've got a circuit. send a padding cell. */
log_fn(LOG_DEBUG,"Sending keepalive to (%s:%d)",
@@ -543,7 +546,7 @@ static int do_main_loop(void) {
/* let catch() handle things like ^c, and otherwise don't worry about it */
if(poll_result < 0) {
if(errno != EINTR) { /* let the program survive things like ^z */
- log_fn(LOG_ERR,"poll failed.");
+ log_fn(LOG_ERR,"poll failed: %s",strerror(errno));
return -1;
} else {
log_fn(LOG_DEBUG,"poll interrupted.");