[or-cvs] Remove dead code

Nick Mathewson nickm at seul.org
Wed Nov 12 02:58:47 UTC 2003


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv18270/or

Modified Files:
	circuit.c onion.c or.h 
Log Message:
Remove dead code

Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- circuit.c	12 Nov 2003 02:55:38 -0000	1.86
+++ circuit.c	12 Nov 2003 02:58:45 -0000	1.87
@@ -758,7 +758,7 @@
     assert(circ->state == CIRCUIT_STATE_BUILDING);
     log_fn(LOG_DEBUG,"starting to send subsequent skin.");
     r = onion_extend_cpath(&circ->cpath, circ->desired_cpath_len, &router);
-    if (r==1) {
+    if (r==1 || !router) {
       /* done building the circuit. whew. */
       circ->state = CIRCUIT_STATE_OPEN;
       log_fn(LOG_INFO,"circuit built! (%d hops long)",circ->desired_cpath_len);
@@ -771,12 +771,6 @@
       return -1;
     }
     hop = circ->cpath->prev;
-
-    router = router_get_by_addr_port(hop->addr,hop->port);
-    if(!router) {
-      log_fn(LOG_WARN,"couldn't lookup router %d:%d",hop->addr,hop->port);
-      return -1;
-    }
 
     memset(&cell, 0, sizeof(cell_t));
     cell.command = CELL_RELAY; 

Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- onion.c	12 Nov 2003 02:55:38 -0000	1.78
+++ onion.c	12 Nov 2003 02:58:45 -0000	1.79
@@ -249,38 +249,6 @@
   return num;
 }
 
-/* XXX This function should be replaced by calls to onion_extend_cpath */
-crypt_path_t *onion_generate_cpath(routerinfo_t **firsthop) {
-  int routelen;
-  crypt_path_t *cpath=NULL;
-  int r;
-  directory_t *dir;
-  routerinfo_t **rarray;
-  int rarray_len;
-
-  assert(firsthop);
-  *firsthop = NULL;
-
-  router_get_directory(&dir);
-  rarray = dir->routers;
-  rarray_len = dir->n_routers;
-  
-  routelen = new_route_len(options.CoinWeight, rarray, rarray_len);
-  if (routelen < 0) return NULL;
-  
-  while (1) {
-    r = onion_extend_cpath(&cpath, routelen, cpath ? NULL : firsthop);
-    if (r < 0) {
-      if (cpath) circuit_free_cpath(cpath);
-      return NULL;
-    } else if (r == 1) {
-      break;
-    }
-    /* r == 0; keep on chugging. */
-  }
-  return cpath;
-}
-
 int onion_extend_cpath(crypt_path_t **head_ptr, int path_len, routerinfo_t **router_out)
 {
   int cur_len;

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -d -r1.180 -r1.181
--- or.h	12 Nov 2003 02:55:38 -0000	1.180
+++ or.h	12 Nov 2003 02:58:45 -0000	1.181
@@ -693,7 +693,6 @@
 
 int onionskin_answer(circuit_t *circ, unsigned char *payload, unsigned char *keys);
 
-crypt_path_t *onion_generate_cpath(routerinfo_t **firsthop);
 int onion_extend_cpath(crypt_path_t **head_ptr, int path_len, routerinfo_t **router_out);
 
 int onion_skin_create(crypto_pk_env_t *router_key,



More information about the tor-commits mailing list