[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Make has_sent_end irrelevant: only try to send end if reaso...



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv7143/src/or

Modified Files:
	circuit.c connection.c connection_edge.c 
Log Message:
Make has_sent_end irrelevant: only try to send end if reason is nonzero

Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -d -r1.139 -r1.140
--- circuit.c	27 Feb 2004 23:23:33 -0000	1.139
+++ circuit.c	28 Feb 2004 03:06:31 -0000	1.140
@@ -1159,7 +1159,6 @@
         /* no need to send 'end' relay cells,
          * because the other side's already dead
          */
-        stream->has_sent_end = 1;
         connection_mark_for_close(stream,0);
       }
     }

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- connection.c	27 Feb 2004 23:30:27 -0000	1.156
+++ connection.c	28 Feb 2004 03:06:31 -0000	1.157
@@ -167,9 +167,7 @@
     case CONN_TYPE_AP:
       if (conn->state == EXIT_CONN_STATE_RESOLVING)
         dns_cancel_pending_resolve(conn->address, conn);
-      if (reason < _MIN_END_STREAM_REASON || reason > _MAX_END_STREAM_REASON)
-        reason = END_STREAM_REASON_MISC;
-      if (!conn->has_sent_end &&
+      if (!conn->has_sent_end && reason &&
           connection_edge_end(conn, reason, conn->cpath_layer) < 0)
         return -1;
       break;

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- connection_edge.c	27 Feb 2004 23:23:33 -0000	1.95
+++ connection_edge.c	28 Feb 2004 03:06:31 -0000	1.96
@@ -147,7 +147,7 @@
   if(!circ) {
     log_fn(LOG_WARN,"no circ. Closing.");
     assert(fromconn);
-    connection_mark_for_close(fromconn,0);
+    connection_mark_for_close(fromconn, 0);
     return -1;
   }
 
@@ -204,7 +204,6 @@
     if(rh.command == RELAY_COMMAND_END) {
       log_fn(LOG_INFO,"Exit got end (%s) before we're connected. Marking for close.",
         connection_edge_end_reason(cell->payload+RELAY_HEADER_SIZE, rh.length));
-      conn->has_sent_end = 1; /* So we don't send an end cell. */
       connection_mark_for_close(conn, 0);
       return 0;
     }
@@ -306,11 +305,9 @@
       conn->done_sending = 1;
       shutdown(conn->s, 1); /* XXX check return; refactor NM */
       if (conn->done_receiving) {
-        conn->has_sent_end = 1; /* no need to send end, we just got one! */
-        connection_mark_for_close(conn, END_STREAM_REASON_DONE);
+        connection_mark_for_close(conn, 0);
       }
 #else
-      conn->has_sent_end = 1; /* no need to send end, we just got one! */
       connection_mark_for_close(conn, 0);
 #endif
       return 0;
@@ -534,7 +531,7 @@
       conn->timestamp_lastread += 15;
       if(connection_ap_handshake_attach_circuit(conn)<0) {
         /* it will never work */
-        conn->has_sent_end = 1; /* Don't need to send end -- why? */
+        /* 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
@@ -561,8 +558,7 @@
       continue;
     if(connection_ap_handshake_attach_circuit(conn) < 0) {
       /* it will never work */
-      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) */
+      /* Don't send end; there is no 'other end' of the stream */
       connection_mark_for_close(conn,0);
     }
   }
@@ -728,7 +724,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 */
+    /* Don't send end: there is no 'other side' yet */
     connection_mark_for_close(ap_conn, 0);
     return;
   }