aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-04-02 23:54:48 +0000
committerRoger Dingledine <arma@torproject.org>2004-04-02 23:54:48 +0000
commit2202c2c7eca9b4ff86fc3f0730af698142739dad (patch)
treed16857dbab0c7f41669b5ca60fe459258c0b5584
parent2bc2f1ed032a21f8b751e3d85ba56318fef0f9ed (diff)
downloadtor-2202c2c7eca9b4ff86fc3f0730af698142739dad.tar
tor-2202c2c7eca9b4ff86fc3f0730af698142739dad.tar.gz
AP conns use conn->rend_query now too
expose connection_ap_handshake_attach_circuit() svn:r1448
-rw-r--r--src/or/circuit.c4
-rw-r--r--src/or/connection_edge.c11
-rw-r--r--src/or/or.h5
-rw-r--r--src/or/rendclient.c2
4 files changed, 12 insertions, 10 deletions
diff --git a/src/or/circuit.c b/src/or/circuit.c
index 0ffef57f9..cd87d59c7 100644
--- a/src/or/circuit.c
+++ b/src/or/circuit.c
@@ -298,7 +298,7 @@ circuit_t *circuit_get_newest(connection_t *conn,
continue;
}
} else { /* not general */
- if(rend_cmp_service_ids(conn->socks_request->address, circ->rend_query)) {
+ if(rend_cmp_service_ids(conn->rend_query, circ->rend_query)) {
/* this circ is not for this conn */
continue;
}
@@ -1070,7 +1070,7 @@ static void circuit_failed(circuit_t *circ) {
/* we should examine circ and see if it failed because of
* the last hop or an earlier hop. then use this info below.
*/
- int failed_at_last_hop;
+ //int failed_at_last_hop;
switch(circ->purpose) {
case CIRCUIT_PURPOSE_C_GENERAL:
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 83459e348..a253b77bd 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -9,7 +9,6 @@ extern or_options_t options; /* command-line and config-file options */
extern char *conn_state_to_string[][_CONN_TYPE_MAX+1];
static int connection_ap_handshake_process_socks(connection_t *conn);
-static int connection_ap_handshake_attach_circuit(connection_t *conn);
static void connection_ap_handshake_send_begin(connection_t *ap_conn, circuit_t *circ);
static int connection_exit_begin_conn(cell_t *cell, circuit_t *circ);
@@ -745,8 +744,9 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
const char *descp;
int desc_len;
+ strcpy(conn->rend_query, socks->address);
/* see if we already have it cached */
- if (rend_cache_lookup(socks->address, &descp, &desc_len) == 1) {
+ if (rend_cache_lookup(conn->rend_query, &descp, &desc_len) == 1) {
conn->purpose = AP_PURPOSE_RENDPOINT_WAIT;
return connection_ap_handshake_attach_circuit(conn);
//circuit_launch_new(CIRCUIT_PURPOSE_C_ESTABLISH_REND, NULL);
@@ -755,7 +755,7 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
/* initiate a dir hidserv desc lookup */
directory_initiate_command(router_pick_directory_server(),
DIR_PURPOSE_FETCH_RENDDESC,
- socks->address, strlen(socks->address));
+ conn->rend_query, strlen(conn->rend_query));
return 0;
}
}
@@ -769,7 +769,7 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
* Otherwise, associate conn with a safe live circuit, do the
* right next step, and return 1.
*/
-static int connection_ap_handshake_attach_circuit(connection_t *conn) {
+int connection_ap_handshake_attach_circuit(connection_t *conn) {
circuit_t *circ;
uint32_t addr;
uint8_t desired_circuit_purpose;
@@ -820,8 +820,7 @@ static int connection_ap_handshake_attach_circuit(connection_t *conn) {
if (desired_circuit_purpose == CIRCUIT_PURPOSE_C_GENERAL ||
desired_circuit_purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND) {
/* then write the service_id into circ */
- strncpy(circ->rend_query, conn->socks_request->address,
- CRYPTO_SHA1_DIGEST_LEN); /* pad with nuls */
+ strcpy(circ->rend_query, conn->rend_query);
}
}
return 0;
diff --git a/src/or/or.h b/src/or/or.h
index 2265327f6..43ca18bae 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -404,7 +404,7 @@ struct connection_t {
* add 'bandwidth' to this, capping it at 10*bandwidth.
*/
-/* Used only by dir connections: */
+/* Used only by DIR and AP connections: */
char rend_query[REND_SERVICE_ID_LEN+1];
/* Used only by edge connections: */
@@ -845,6 +845,8 @@ int connection_edge_finished_flushing(connection_t *conn);
int connection_edge_package_raw_inbuf(connection_t *conn);
+int connection_ap_handshake_attach_circuit(connection_t *conn);
+
int connection_ap_make_bridge(char *address, uint16_t port);
void connection_ap_handshake_socks_reply(connection_t *conn, char *reply,
@@ -978,6 +980,7 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router,
/********************************* routerlist.c ***************************/
routerinfo_t *router_pick_directory_server(void);
+struct smartlist_t;
routerinfo_t *router_choose_random_node(routerlist_t *dir,
char *preferred, char *excluded,
struct smartlist_t *excludedsmartlist);
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 1882d3f40..8f8aa2679 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -49,7 +49,7 @@ void rend_client_desc_fetched(char *query, int success) {
continue;
if (conn->purpose != AP_PURPOSE_RENDDESC_WAIT)
continue;
- if (rend_cmp_service_ids(conn->socks_request->address, query))
+ if (rend_cmp_service_ids(conn->rend_query, query))
continue;
/* great, this guy was waiting */
if(success) {