[or-cvs] patches/answers to nick"s commit

Roger Dingledine arma at seul.org
Fri Feb 27 23:23:35 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	circuit.c connection.c connection_edge.c main.c 
Log Message:
patches/answers to nick's commit


Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- circuit.c	27 Feb 2004 22:00:26 -0000	1.138
+++ circuit.c	27 Feb 2004 23:23:33 -0000	1.139
@@ -64,8 +64,6 @@
 
   circ->timestamp_created = time(NULL);
 
-  circ->marked_for_close = 0;
-
   circ->p_circ_id = p_circ_id;
   circ->p_conn = p_conn;
 

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -d -r1.154 -r1.155
--- connection.c	27 Feb 2004 22:00:26 -0000	1.154
+++ connection.c	27 Feb 2004 23:23:33 -0000	1.155
@@ -350,10 +350,11 @@
 }
 
 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 @@
   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;
   }

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- connection_edge.c	27 Feb 2004 22:00:26 -0000	1.94
+++ connection_edge.c	27 Feb 2004 23:23:33 -0000	1.95
@@ -535,6 +535,10 @@
       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 @@
       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 @@
 
   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;
   }

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.173
retrieving revision 1.174
diff -u -d -r1.173 -r1.174
--- main.c	27 Feb 2004 22:00:26 -0000	1.173
+++ main.c	27 Feb 2004 23:23:33 -0000	1.174
@@ -273,6 +273,9 @@
       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 @@
     /* 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.");



More information about the tor-commits mailing list