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

[or-cvs] make unattached rend streams expire after a while (60s)



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

Modified Files:
	circuit.c connection_edge.c 
Log Message:
make unattached rend streams expire after a while (60s)
(they were darned persistent)

also make intro circs that are waiting for acks expire after a while (20s)


Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.210
retrieving revision 1.211
diff -u -d -r1.210 -r1.211
--- circuit.c	14 Apr 2004 23:52:29 -0000	1.210
+++ circuit.c	15 Apr 2004 01:08:59 -0000	1.211
@@ -485,12 +485,12 @@
          victim->purpose == CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT) &&
         victim->timestamp_dirty + MIN_SECONDS_BEFORE_EXPIRING_CIRC > now)) {
       if(victim->n_conn)
-        log_fn(LOG_INFO,"Abandoning circ %s:%d:%d (state %d:%s)",
+        log_fn(LOG_INFO,"Abandoning circ %s:%d:%d (state %d:%s, purpose %d)",
                victim->n_conn->address, victim->n_port, victim->n_circ_id,
-               victim->state, circuit_state_to_string[victim->state]);
+               victim->state, circuit_state_to_string[victim->state], victim->purpose);
       else
-        log_fn(LOG_INFO,"Abandoning circ %d (state %d:%s)", victim->n_circ_id,
-               victim->state, circuit_state_to_string[victim->state]);
+        log_fn(LOG_INFO,"Abandoning circ %d (state %d:%s, purpose %d)", victim->n_circ_id,
+               victim->state, circuit_state_to_string[victim->state], victim->purpose);
       circuit_log_path(LOG_INFO,victim);
       circuit_mark_for_close(victim);
     }

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -d -r1.163 -r1.164
--- connection_edge.c	15 Apr 2004 00:03:48 -0000	1.163
+++ connection_edge.c	15 Apr 2004 01:08:59 -0000	1.164
@@ -871,6 +871,12 @@
   assert(conn->state == AP_CONN_STATE_CIRCUIT_WAIT);
   assert(conn->socks_request);
 
+  if(conn->timestamp_created < time(NULL)-60) {
+    /* XXX make this cleaner than '60' */
+    log_fn(LOG_WARN,"Giving up on attached circ (60s late).");
+    connection_mark_for_close(conn, 0);
+  }
+
   if(!connection_edge_is_rendezvous_stream(conn)) { /* we're a general conn */
     circuit_t *circ=NULL;
 
@@ -941,8 +947,10 @@
         if(rend_client_send_introduction(introcirc, rendcirc) < 0) {
           return -1;
         }
-        if(!rendcirc->timestamp_dirty)
-          rendcirc->timestamp_dirty = time(NULL);
+        assert(!rendcirc->timestamp_dirty);
+        rendcirc->timestamp_dirty = time(NULL);
+        assert(!introcirc->timestamp_dirty);
+        introcirc->timestamp_dirty = time(NULL);
         return 0;
       }
     }