summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-10-07 06:28:50 +0000
committerRoger Dingledine <arma@torproject.org>2006-10-07 06:28:50 +0000
commitf2bd0e2f16944de3b3c8722fb9412ad60d0fae2c (patch)
treeee2176a6ba2a62879e963f522c029f54d7b003d3 /src/or
parent4f3827f1d1365fa8da9f014463d8f3e6acce6b6c (diff)
downloadtor-f2bd0e2f16944de3b3c8722fb9412ad60d0fae2c.tar.gz
tor-f2bd0e2f16944de3b3c8722fb9412ad60d0fae2c.zip
more minor cleanups
svn:r8630
Diffstat (limited to 'src/or')
-rw-r--r--src/or/circuitbuild.c28
-rw-r--r--src/or/config.c4
-rw-r--r--src/or/directory.c5
-rw-r--r--src/or/relay.c2
-rw-r--r--src/or/routerlist.c2
5 files changed, 14 insertions, 27 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 0edb53367c..caed74c897 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -49,8 +49,7 @@ static int circuit_deliver_create_cell(circuit_t *circ,
uint8_t cell_type, char *payload);
static int onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit);
static crypt_path_t *onion_next_hop_in_cpath(crypt_path_t *cpath);
-static int onion_extend_cpath(uint8_t purpose, crypt_path_t **head_ptr,
- cpath_build_state_t *state);
+static int onion_extend_cpath(origin_circuit_t *circ);
static int count_acceptable_routers(smartlist_t *routers);
static int onion_append_hop(crypt_path_t **head_ptr, extend_info_t *choice);
@@ -263,7 +262,7 @@ onion_populate_cpath(origin_circuit_t *circ)
{
int r;
again:
- r = onion_extend_cpath(circ->_base.purpose, &circ->cpath, circ->build_state);
+ r = onion_extend_cpath(circ);
if (r < 0) {
log_info(LD_CIRC,"Generating cpath hop failed.");
return -1;
@@ -1632,24 +1631,13 @@ onion_next_hop_in_cpath(crypt_path_t *cpath)
* based on <b>state</b>. Append the hop info to head_ptr.
*/
static int
-onion_extend_cpath(uint8_t purpose, crypt_path_t **head_ptr,
- cpath_build_state_t *state)
+onion_extend_cpath(origin_circuit_t *circ)
{
- int cur_len;
- crypt_path_t *cpath;
+ uint8_t purpose = circ->_base.purpose;
+ cpath_build_state_t *state = circ->build_state;
+ int cur_len = circuit_get_cpath_len(circ);
extend_info_t *info = NULL;
- tor_assert(head_ptr);
-
- if (!*head_ptr) {
- cur_len = 0;
- } else {
- cur_len = 1;
- for (cpath = *head_ptr; cpath->next != *head_ptr; cpath = cpath->next) {
- ++cur_len;
- }
- }
-
if (cur_len >= state->desired_path_len) {
log_debug(LD_CIRC, "Path is complete: %d steps long",
state->desired_path_len);
@@ -1667,7 +1655,7 @@ onion_extend_cpath(uint8_t purpose, crypt_path_t **head_ptr,
info = extend_info_from_router(r);
} else {
routerinfo_t *r =
- choose_good_middle_server(purpose, state, *head_ptr, cur_len);
+ choose_good_middle_server(purpose, state, circ->cpath, cur_len);
if (r)
info = extend_info_from_router(r);
}
@@ -1681,7 +1669,7 @@ onion_extend_cpath(uint8_t purpose, crypt_path_t **head_ptr,
log_debug(LD_CIRC,"Chose router %s for hop %d (exit is %s)",
info->nickname, cur_len+1, build_state_get_exit_nickname(state));
- onion_append_hop(head_ptr, info);
+ onion_append_hop(&circ->cpath, info);
extend_info_free(info);
return 0;
}
diff --git a/src/or/config.c b/src/or/config.c
index 7b76288306..ac604bd35f 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -3467,8 +3467,8 @@ write_configuration_file(const char *fname, or_options_t *options)
log_notice(LD_CONFIG, "Renaming old configuration file to \"%s\"", fn_tmp);
if (rename(fname, fn_tmp) < 0) {
log_warn(LD_FS,
- "Couldn't rename configuration file \"%s\" to \"%s\": %s",
- fname, fn_tmp, strerror(errno));
+ "Couldn't rename configuration file \"%s\" to \"%s\": %s",
+ fname, fn_tmp, strerror(errno));
tor_free(fn_tmp);
goto err;
}
diff --git a/src/or/directory.c b/src/or/directory.c
index 7d1766d6f5..afafd6f317 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -1160,7 +1160,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
break;
default:
log_warn(LD_GENERAL,
- "http status %d (%s) reason unexpected while uploding "
+ "http status %d (%s) reason unexpected while uploading "
"descriptor to server '%s:%d').",
status_code, escaped(reason), conn->_base.address,
conn->_base.port);
@@ -1197,8 +1197,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
break;
default:
log_warn(LD_REND,"http status %d (%s) response unexpected while "
- "fetching hidden service descriptor (server "
- "'%s:%d').",
+ "fetching hidden service descriptor (server '%s:%d').",
status_code, escaped(reason), conn->_base.address,
conn->_base.port);
break;
diff --git a/src/or/relay.c b/src/or/relay.c
index 36cff71297..c7409c9a57 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -590,7 +590,7 @@ connection_edge_end_reason_socks5_response(int reason)
return SOCKS5_NET_UNREACHABLE;
default:
log_warn(LD_PROTOCOL,"Reason for ending (%d) not recognized; "
- "sending generic socks error.",reason);
+ "sending generic socks error.", reason);
return SOCKS5_GENERAL_ERROR;
}
}
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index ed63fd0e40..f8a22a1926 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -3481,7 +3481,7 @@ routers_update_status_from_networkstatus(smartlist_t *routers,
router->is_fast = rs->status.is_fast;
router->is_stable = rs->status.is_stable;
router->is_possible_guard = rs->status.is_possible_guard;
- router->is_exit = rs->status.is_exit;
+ router->is_exit = rs->status.is_exit;
}
if (router->is_running && ds) {
ds->n_networkstatus_failures = 0;