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

[or-cvs] bugfix on a really old bug:



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

Modified Files:
	connection.c 
Log Message:
bugfix on a really old bug:
if read() fails on a stream, send back an end cell before you
close it down.


Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.261
retrieving revision 1.262
diff -u -d -r1.261 -r1.262
--- connection.c	14 Oct 2004 03:18:14 -0000	1.261
+++ connection.c	14 Oct 2004 09:28:31 -0000	1.262
@@ -733,14 +733,18 @@
   if(connection_read_to_buf(conn) < 0) {
     /* There's a read error; kill the connection.*/
     connection_close_immediate(conn); /* Don't flush; connection is dead. */
-    conn->has_sent_end = 1; /* XXX have we already sent the end? really? */
+    if(conn->type == CONN_TYPE_AP || conn->type == CONN_TYPE_EXIT) {
+      connection_edge_end(conn, connection_state_is_open(conn) ?
+                          END_STREAM_REASON_MISC : END_STREAM_REASON_CONNECTFAILED,
+                          conn->cpath_layer);
+    }
     connection_mark_for_close(conn);
     if(conn->type == CONN_TYPE_DIR &&
        conn->state == DIR_CONN_STATE_CONNECTING) {
        /* it's a directory server and connecting failed: forget about this router */
        /* XXX I suspect pollerr may make Windows not get to this point. :( */
        router_mark_as_down(conn->identity_digest);
-       if(conn->purpose == DIR_PURPOSE_FETCH_DIR && 
+       if(conn->purpose == DIR_PURPOSE_FETCH_DIR &&
           !all_trusted_directory_servers_down()) {
          log_fn(LOG_INFO,"Giving up on dirserver %s; trying another.", conn->address);
          directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR, NULL, 0);