summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-02-17 08:29:22 +0000
committerNick Mathewson <nickm@torproject.org>2004-02-17 08:29:22 +0000
commitbd14023afd24abef9f74e7cf6e97cd742a0c7b9e (patch)
tree53499b3eee246be631696267c9bb7a163e494543
parentd081d1d0611523d71e041f7943e87727616266a5 (diff)
downloadtor-bd14023afd24abef9f74e7cf6e97cd742a0c7b9e.tar.gz
tor-bd14023afd24abef9f74e7cf6e97cd742a0c7b9e.zip
Propagate yes/no/maybe a little farther forward.
svn:r1096
-rw-r--r--src/or/circuit.c4
-rw-r--r--src/or/connection_edge.c2
-rw-r--r--src/or/onion.c6
-rw-r--r--src/or/router.c2
4 files changed, 7 insertions, 7 deletions
diff --git a/src/or/circuit.c b/src/or/circuit.c
index 4edf11cba5..67c79fcbc2 100644
--- a/src/or/circuit.c
+++ b/src/or/circuit.c
@@ -222,7 +222,7 @@ circuit_t *circuit_get_newest(connection_t *conn, int must_be_open) {
exitrouter = router_get_by_addr_port(circ->cpath->prev->addr, circ->cpath->prev->port);
else /* not open */
exitrouter = router_get_by_nickname(circ->build_state->chosen_exit);
- if(!exitrouter || connection_ap_can_use_exit(conn, exitrouter) < 0) {
+ if(!exitrouter || connection_ap_can_use_exit(conn, exitrouter) == ADDR_POLICY_REJECTED) {
/* can't exit from this router */
continue;
}
@@ -305,7 +305,7 @@ int circuit_stream_is_being_handled(connection_t *conn) {
for(circ=global_circuitlist;circ;circ = circ->next) {
if(circ->cpath && circ->state != CIRCUIT_STATE_OPEN) {
exitrouter = router_get_by_nickname(circ->build_state->chosen_exit);
- if(exitrouter && connection_ap_can_use_exit(conn, exitrouter) >= 0)
+ if(exitrouter && connection_ap_can_use_exit(conn, exitrouter) != ADDR_POLICY_REJECTED)
if(++num >= MIN_CIRCUITS_HANDLING_STREAM)
return 1;
}
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index ddcabad811..706a124bc8 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -861,7 +861,7 @@ static int connection_exit_begin_conn(cell_t *cell, circuit_t *circ) {
void connection_exit_connect(connection_t *conn) {
unsigned char connected_payload[4];
- if(router_compare_to_my_exit_policy(conn) < 0) {
+ if(router_compare_to_my_exit_policy(conn) == ADDR_POLICY_REJECTED) {
log_fn(LOG_INFO,"%s:%d failed exit policy. Closing.", conn->address, conn->port);
if(connection_edge_end(conn, END_STREAM_REASON_EXITPOLICY, NULL) < 0)
log_fn(LOG_WARN,"1: I called connection_edge_end redundantly.");
diff --git a/src/or/onion.c b/src/or/onion.c
index af55a9ac73..b5cc3f9546 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -269,12 +269,12 @@ static routerinfo_t *choose_good_exit_server(routerlist_t *dir)
continue; /* Skip everything but APs in CIRCUIT_WAIT */
switch (connection_ap_can_use_exit(carray[j], dir->routers[i]))
{
- case -1:
+ case ADDR_POLICY_REJECTED:
log_fn(LOG_DEBUG,"%s (index %d) would reject this stream.",
dir->routers[i]->nickname, i);
break; /* would be rejected; try next connection */
- case 0:
- case 1:
+ case ADDR_POLICY_ACCEPTED:
+ case ADDR_POLICY_UNKNOWN:
++n_supported[i];
log_fn(LOG_DEBUG,"%s is supported. n_supported[%d] now %d.",
dir->routers[i]->nickname, i, n_supported[i]);
diff --git a/src/or/router.c b/src/or/router.c
index 076d148b77..7fe5e94e11 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -295,7 +295,7 @@ int router_compare_to_my_exit_policy(connection_t *conn) {
way we can't get a 'maybe' below. */
return router_compare_addr_to_exit_policy(conn->addr, conn->port,
- desc_routerinfo->exit_policy) == ADDR_POLICY_ACCEPTED;
+ desc_routerinfo->exit_policy);
}