trivial changes on nick's rendezvous commit

svn:r4553
This commit is contained in:
Roger Dingledine 2005-07-14 08:43:19 +00:00
parent 57ba20e376
commit 2259032ea1
6 changed files with 33 additions and 28 deletions

View file

@ -89,7 +89,7 @@ circuit_list_path(circuit_t *circ, int verbose)
circ->build_state->is_internal ? "internal" : "exit",
circ->build_state->need_uptime ? " (high-uptime)" : "",
circ->build_state->desired_path_len,
nickname?nickname:"unnamed");
nickname?nickname:"*unnamed*");
smartlist_add(elements, tor_strdup(buf));
}
@ -103,6 +103,7 @@ circuit_list_path(circuit_t *circ, int verbose)
if (!hop->extend_info)
break;
elt = hop->extend_info->nickname;
tor_assert(elt);
if (verbose) {
size_t len = strlen(elt)+2+strlen(states[hop->state])+1;
char *v = tor_malloc(len);
@ -309,6 +310,7 @@ circuit_handle_first_hop(circuit_t *circ)
firsthop = onion_next_hop_in_cpath(circ->cpath);
tor_assert(firsthop);
tor_assert(firsthop->extend_info);
/* now see if we're already connected to the first OR in 'route' */
in.s_addr = htonl(firsthop->extend_info->addr);
@ -1229,7 +1231,8 @@ onion_pick_cpath_exit(circuit_t *circ, extend_info_t *exit)
log_fn(LOG_INFO,"Using requested exit node '%s'", exit->nickname);
exit = extend_info_dup(exit);
} else { /* we have to decide one */
routerinfo_t *router = choose_good_exit_server(circ->purpose, rl,
routerinfo_t *router =
choose_good_exit_server(circ->purpose, rl,
state->need_uptime, state->need_capacity);
if (!router) {
log_fn(LOG_WARN,"failed to choose an exit server");

View file

@ -33,7 +33,7 @@ struct orconn_circid_circuit_map_t {
circuit_t *circuit;
};
/** helper for RB tree: compare the OR connection and circuit ID for a and b,
/** Helper for RB tree: compare the OR connection and circuit ID for a and b,
* and return less than, equal to, or greater than zero appropriately.
*/
static INLINE int
@ -52,15 +52,17 @@ static RB_HEAD(orconn_circid_tree, orconn_circid_circuit_map_t) orconn_circid_ci
RB_PROTOTYPE(orconn_circid_tree, orconn_circid_circuit_map_t, node, compare_orconn_circid_entries);
RB_GENERATE(orconn_circid_tree, orconn_circid_circuit_map_t, node, compare_orconn_circid_entries);
/** The most recently returned entyr from circuit_get_by_circid_orconn; used
* to improve performance when many cells arrive in a row from the same circuit.
/** The most recently returned entry from circuit_get_by_circid_orconn;
* used to improve performance when many cells arrive in a row from the
* same circuit.
*/
/* (We tried using splay trees, but round-robin turned out to make them suck.) */
/* (We tried using splay trees, but round-robin turned out to make them
* suck.) */
struct orconn_circid_circuit_map_t *_last_circid_orconn_ent = NULL;
/** Set the p_conn or n_conn field of a circuit <b>circ</b>, along with the
* corresponding circuit ID, and add the circuit as appropriate to the
* (orconn,id)-\>circuit map. */
/** Set the p_conn or n_conn field of a circuit <b>circ</b>, along
* with the corresponding circuit ID, and add the circuit as appropriate
* to the (orconn,id)-\>circuit map. */
void
circuit_set_circid_orconn(circuit_t *circ, uint16_t id,
connection_t *conn,

View file

@ -703,8 +703,8 @@ static int did_circs_fail_last_period = 0;
* success. */
#define MAX_CIRCUIT_FAILURES 5
/** Launch a new circuit; see circuit_launch_by_extend_info for details on
* arguments. */
/** Launch a new circuit; see circuit_launch_by_extend_info() for
* details on arguments. */
circuit_t *
circuit_launch_by_router(uint8_t purpose, routerinfo_t *exit,
int need_uptime, int need_capacity, int internal)
@ -788,8 +788,8 @@ circuit_launch_by_extend_info(uint8_t purpose, extend_info_t *info,
need_uptime, need_capacity, internal);
}
/** Launch a new circuit; see circuit_launch_by_extend_info for details on
* arguments. */
/** Launch a new circuit; see circuit_launch_by_extend_info() for
* details on arguments. */
circuit_t *
circuit_launch_by_nickname(uint8_t purpose, const char *exit_nickname,
int need_uptime, int need_capacity, int internal)

View file

@ -38,10 +38,10 @@ conn_type_to_string(int type)
case CONN_TYPE_OR_LISTENER: return "OR listener";
case CONN_TYPE_OR: return "OR";
case CONN_TYPE_EXIT: return "Exit";
case CONN_TYPE_AP_LISTENER: return "App listener";
case CONN_TYPE_AP: return "App";
case CONN_TYPE_DIR_LISTENER: return "Dir listener";
case CONN_TYPE_DIR: return "Dir";
case CONN_TYPE_AP_LISTENER: return "Socks listener";
case CONN_TYPE_AP: return "Socks";
case CONN_TYPE_DIR_LISTENER: return "Directory listener";
case CONN_TYPE_DIR: return "Directory";
case CONN_TYPE_DNSWORKER: return "DNS worker";
case CONN_TYPE_CPUWORKER: return "CPU worker";
case CONN_TYPE_CONTROL_LISTENER: return "Control listener";

View file

@ -767,15 +767,15 @@ typedef struct {
char *signing_router;
} routerlist_t;
/** Informetation on router used when extending a circuit. (We don't need a
/** Information on router used when extending a circuit. (We don't need a
* full routerinfo_t to extend: we only need addr:port:keyid to build an OR
* connection, and onion_key to create the onionskin.) */
typedef struct extend_info_t {
char nickname[MAX_HEX_NICKNAME_LEN+1]; /**< This router's nickname for display*/
char identity_digest[DIGEST_LEN]; /**< Hash of this router's identity key */
uint32_t addr; /**< IP address in host order */
uint16_t port; /**< OR port */
crypto_pk_env_t *onion_key; /**< Current onionskin key */
char nickname[MAX_HEX_NICKNAME_LEN+1]; /**< This router's nickname for display. */
char identity_digest[DIGEST_LEN]; /**< Hash of this router's identity key. */
uint32_t addr; /**< IP address in host order. */
uint16_t port; /**< OR port. */
crypto_pk_env_t *onion_key; /**< Current onionskin key. */
} extend_info_t;
#define CRYPT_PATH_MAGIC 0x70127012u
@ -1749,12 +1749,12 @@ int rend_client_send_introduction(circuit_t *introcirc, circuit_t *rendcirc);
/********************************* rendcommon.c ***************************/
/** Information used to connect to a hidden service. */
/** Information used to connect to a hidden service. */
typedef struct rend_service_descriptor_t {
crypto_pk_env_t *pk; /**< This service's public key. */
int version; /**< 0 or 1 */
int version; /**< 0 or 1. */
time_t timestamp; /**< Time when the descriptor was generated. */
uint16_t protocols; /**< Bitmask: which rendezvous protocols are supporeted?
uint16_t protocols; /**< Bitmask: which rendezvous protocols are supported?
* (We allow bits '0', '1', and '2' to be set.) */
int n_intro_points; /**< Number of introduction points. */
/** Array of n_intro_points elements for this service's introduction points'

View file

@ -214,7 +214,7 @@ rend_client_introduction_acked(circuit_t *circ,
*/
if (rend_client_remove_intro_point(circ->build_state->chosen_exit,
circ->rend_query) > 0) {
/* There are introduction points left. re-extend the circuit to
/* There are introduction points left. Re-extend the circuit to
* another intro point and try again. */
extend_info_t *info;
int result;
@ -225,7 +225,7 @@ rend_client_introduction_acked(circuit_t *circ,
circuit_mark_for_close(circ);
return -1;
}
log_fn(LOG_INFO,"Got nack for %s from %s, extending circ %d to %s.",
log_fn(LOG_INFO,"Got nack for %s from %s. Re-extending circ %d, this time to %s.",
safe_str(circ->rend_query),
circ->build_state->chosen_exit->nickname, circ->n_circ_id,
info->nickname);