[or-cvs] deal better if we don"t have enough available nodes to choo...

Roger Dingledine arma at seul.org
Tue Aug 17 12:09:39 UTC 2004


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

Modified Files:
	circuitbuild.c 
Log Message:
deal better if we don't have enough available nodes to choose a path


Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuitbuild.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- circuitbuild.c	17 Aug 2004 07:09:02 -0000	1.25
+++ circuitbuild.c	17 Aug 2004 12:09:37 -0000	1.26
@@ -211,8 +211,8 @@
     return NULL;
   }
 
-  onion_extend_cpath(&circ->cpath, circ->build_state, &firsthop);
-  if(!CIRCUIT_IS_ORIGIN(circ)) {
+  if(onion_extend_cpath(&circ->cpath, circ->build_state, &firsthop)<0 ||
+     !CIRCUIT_IS_ORIGIN(circ)) {
     log_fn(LOG_INFO,"Generating first cpath hop failed.");
     circuit_mark_for_close(circ);
     return NULL;
@@ -220,6 +220,7 @@
 
   /* now see if we're already connected to the first OR in 'route' */
 
+  tor_assert(firsthop);
   log_fn(LOG_DEBUG,"Looking for firsthop '%s:%u'",
       firsthop->address,firsthop->or_port);
   /* imprint the circuit with its future n_conn->id */
@@ -980,7 +981,7 @@
   routerinfo_t *exit;
   router_get_routerlist(&rl);
   r = new_route_len(options.PathlenCoinWeight, purpose, rl->routers);
-  if (r < 0)
+  if (r < 1) /* must be at least 1 */
     return NULL;
   info = tor_malloc_zero(sizeof(cpath_build_state_t));
   info->desired_path_len = r;



More information about the tor-commits mailing list