[or-cvs] normal circs are 3 hops, but rend/intro circs are 4, because

Roger Dingledine arma at seul.org
Mon Apr 12 18:40:16 UTC 2004


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

Modified Files:
	onion.c 
Log Message:
normal circs are 3 hops, but rend/intro circs are 4, because
the initiator doesn't get to choose the last hop


Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -d -r1.152 -r1.153
--- onion.c	7 Apr 2004 23:31:29 -0000	1.152
+++ onion.c	12 Apr 2004 18:40:14 -0000	1.153
@@ -160,7 +160,7 @@
 
 extern int has_fetched_directory;
 
-static int new_route_len(double cw, smartlist_t *routers) {
+static int new_route_len(double cw, uint8_t purpose, smartlist_t *routers) {
   int num_acceptable_routers;
   int routelen;
 
@@ -169,7 +169,16 @@
 #ifdef TOR_PERF
   routelen = 2;
 #else
-  routelen = 3;
+  if(purpose == CIRCUIT_PURPOSE_C_GENERAL)
+    routelen = 3;
+  else if(purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND)
+    routelen = 4;
+  else if(purpose == CIRCUIT_PURPOSE_S_ESTABLISH_INTRO)
+    routelen = 4;
+  else {
+    log_fn(LOG_WARN,"Unhandled purpose %d", purpose);
+    return -1;
+  }
 #endif
 #if 0
   for(routelen = 3; ; routelen++) { /* 3, increment until coinflip says we're done */
@@ -360,7 +369,7 @@
   routerinfo_t *exit;
 
   router_get_routerlist(&rl);
-  r = new_route_len(options.PathlenCoinWeight, rl->routers);
+  r = new_route_len(options.PathlenCoinWeight, purpose, rl->routers);
   if (r < 0)
     return NULL;
   info = tor_malloc_zero(sizeof(cpath_build_state_t));



More information about the tor-commits mailing list