]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
expire dir connections that live for more than 5 minutes
authorRoger Dingledine <arma@torproject.org>
Sun, 18 Apr 2004 06:35:31 +0000 (06:35 +0000)
committerRoger Dingledine <arma@torproject.org>
Sun, 18 Apr 2004 06:35:31 +0000 (06:35 +0000)
svn:r1663

src/or/connection_edge.c
src/or/main.c

index 0bfca3987171430cffaa96b07dcf0e0b7074164a..fea18fc8f3928223d4bcd141b1b4ed98ce1f2c90 100644 (file)
@@ -757,7 +757,9 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
       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 c80737bf56d6fef39fd2ed8b9138874e5ed56e00..5276f0862439a1c1c872ab20ff84edde99baced0 100644 (file)
@@ -306,6 +306,13 @@ static void run_connection_housekeeping(int i, time_t now) {
   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;