diff options
-rw-r--r-- | src/or/circuit.c | 8 | ||||
-rw-r--r-- | src/or/onion.c | 32 | ||||
-rw-r--r-- | src/or/or.h | 1 |
3 files changed, 1 insertions, 40 deletions
diff --git a/src/or/circuit.c b/src/or/circuit.c index 94ae20e43..206742e65 100644 --- a/src/or/circuit.c +++ b/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; diff --git a/src/or/onion.c b/src/or/onion.c index 848b7e866..25e419096 100644 --- a/src/or/onion.c +++ b/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; diff --git a/src/or/or.h b/src/or/or.h index b0ba5cc7f..6aa5622e1 100644 --- a/src/or/or.h +++ b/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, |