[or-cvs] bugfix: a circuit that immediately failed still counts as a...

Roger Dingledine arma at seul.org
Sat Dec 13 07:42:20 UTC 2003


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

Modified Files:
	circuit.c 
Log Message:
bugfix: a circuit that immediately failed still counts as a failed circuit


Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- circuit.c	12 Dec 2003 23:03:25 -0000	1.113
+++ circuit.c	13 Dec 2003 07:42:18 -0000	1.114
@@ -584,7 +584,8 @@
   for(conn=circ->p_streams; conn; conn=conn->next_stream) {
     connection_send_destroy(circ->p_circ_id, conn); 
   }
-  if (circ->state != CIRCUIT_STATE_OPEN && circ->cpath) {
+  if (circ->state == CIRCUIT_STATE_BUILDING ||
+      circ->state == CIRCUIT_STATE_OR_WAIT) {
     /* If we never built the circuit, note it as a failure. */
     circuit_increment_failure_count();
   }
@@ -719,8 +720,10 @@
   if(!options.SocksPort) /* we're not an application proxy. no need for circuits. */
     return -1;
 
-  if(n_circuit_failures > 5) /* too many failed circs in a row. don't try. */
+  if(n_circuit_failures > 5) { /* too many failed circs in a row. don't try. */
+//    log_fn(LOG_INFO,"%d failures so far, not trying.",n_circuit_failures);
     return -1;
+  }
 
   /* try a circ. if it fails, circuit_close will increment n_circuit_failures */
   circuit_establish_circuit();
@@ -730,6 +733,7 @@
 
 void circuit_increment_failure_count(void) {
   ++n_circuit_failures;
+  log_fn(LOG_DEBUG,"n_circuit_failures now %d.",n_circuit_failures);
 }
 
 void circuit_reset_failure_count(void) {



More information about the tor-commits mailing list