[or-cvs] expire dir connections that live for more than 5 minutes

Roger Dingledine arma at seul.org
Sun Apr 18 06:35:33 UTC 2004


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

Modified Files:
	connection_edge.c main.c 
Log Message:
expire dir connections that live for more than 5 minutes


Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -d -r1.172 -r1.173
--- connection_edge.c	17 Apr 2004 10:25:38 -0000	1.172
+++ connection_edge.c	18 Apr 2004 06:35:31 -0000	1.173
@@ -757,7 +757,9 @@
       return connection_ap_handshake_attach_circuit(conn);
     } else {
       conn->state = AP_CONN_STATE_RENDDESC_WAIT;
-      if(!connection_get_by_type_rendquery(CONN_TYPE_DIR, conn->rend_query)) {
+      if(connection_get_by_type_rendquery(CONN_TYPE_DIR, conn->rend_query)) {
+        log_fn(LOG_INFO,"Would fetch a new renddesc here (for %s), but one is already in progress.", conn->rend_query);
+      } else {
         /* not one already; initiate a dir rend desc lookup */
         directory_initiate_command(router_pick_directory_server(),
                                    DIR_PURPOSE_FETCH_RENDDESC,

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.241
retrieving revision 1.242
diff -u -d -r1.241 -r1.242
--- main.c	17 Apr 2004 06:34:20 -0000	1.241
+++ main.c	18 Apr 2004 06:35:31 -0000	1.242
@@ -306,6 +306,13 @@
   cell_t cell;
   connection_t *conn = connection_array[i];
 
+  if(conn->type == CONN_TYPE_DIR &&
+     conn->timestamp_created + 5*60 > now) {
+    log_fn(LOG_INFO,"Expiring wedged directory conn (purpose %d)", conn->purpose);
+    connection_mark_for_close(conn,0);
+    return;
+  }
+
   /* check connections to see whether we should send a keepalive, expire, or wait */
   if(!connection_speaks_cells(conn))
     return;



More information about the tor-commits mailing list