Browse Source

Remove dead code

svn:r794
Nick Mathewson 22 years ago
parent
commit
2e05b9ccf9
3 changed files with 1 additions and 40 deletions
  1. 1 7
      src/or/circuit.c
  2. 0 32
      src/or/onion.c
  3. 0 1
      src/or/or.h

+ 1 - 7
src/or/circuit.c

@@ -758,7 +758,7 @@ int circuit_send_next_onion_skin(circuit_t *circ) {
     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);
@@ -772,12 +772,6 @@ int circuit_send_next_onion_skin(circuit_t *circ) {
     }
     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; 
     cell.circ_id = circ->n_circ_id;

+ 0 - 32
src/or/onion.c

@@ -249,38 +249,6 @@ static int count_acceptable_routers(routerinfo_t **rarray, int rarray_len) {
   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;

+ 0 - 1
src/or/or.h

@@ -693,7 +693,6 @@ void onion_pending_remove(circuit_t *circ);
 
 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,