From 229761465c92399ea20317370b847c287345e83d Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Tue, 15 Mar 2005 01:44:46 +0000 Subject: [PATCH] re-enable reachability testing stuff. also, consider your ORPort reachable after you've processed a create cell from any non-local address. svn:r3763 --- src/or/circuitbuild.c | 7 +++++++ src/or/circuituse.c | 11 +++-------- src/or/router.c | 8 ++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index ddc40559e3..83fc795862 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -731,6 +731,13 @@ int onionskin_answer(circuit_t *circ, unsigned char *payload, unsigned char *key connection_or_write_cell_to_buf(&cell, circ->p_conn); log_fn(LOG_DEBUG,"Finished sending 'created' cell."); + if (!is_local_IP(circ->p_conn->addr)) { + /* record that we could process create cells; presumably this means + that create cells can reach us too. */ + log_fn(LOG_NOTICE,"Your ORPort is reachable from the outside. Excellent."); + router_orport_found_reachable(); + } + return 0; } diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 74fea1ed2d..7eb5f597c4 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -544,14 +544,9 @@ circuit_expire_old_circuits(void) /** A testing circuit has completed. Take whatever stats we want. */ static void circuit_testing_opened(circuit_t *circ) { - /* For now, we only use testing circuits to see if our ORPort is - reachable. So, if this circuit ends at us, remember that. */ - routerinfo_t *exit = router_get_by_digest(circ->build_state->chosen_exit_digest); - if (exit && router_is_me(exit)) { - log_fn(LOG_NOTICE,"Your ORPort is reachable from the outside. Excellent."); - router_orport_found_reachable(); - } + reachable. But we remember reachability in onionskin_answer(), + so there's no need to record anything here. Just close the circ. */ circuit_mark_for_close(circ); } @@ -563,7 +558,7 @@ circuit_testing_failed(circuit_t *circ, int at_last_hop) { if (!at_last_hop) circuit_launch_by_identity(CIRCUIT_PURPOSE_TESTING, me->identity_digest, 0, 0, 1); else - log_fn(LOG_NOTICE,"The testing circuit has failed. Guess you're not reachable yet."); + log_fn(LOG_INFO,"Our testing circuit (to see if your ORPort is reachable) has failed. I'll try again later."); } /** The circuit circ has just become open. Take the next diff --git a/src/or/router.c b/src/or/router.c index 331ec7b090..785851682d 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -374,9 +374,9 @@ int init_keys(void) { */ /** Whether we can reach our ORPort from the outside. */ -static int can_reach_or_port = 1; +static int can_reach_or_port = 0; /** Whether we can reach our DirPort from the outside. */ -static int can_reach_dir_port = 1; +static int can_reach_dir_port = 0; void consider_testing_reachability(void) { routerinfo_t *me = router_get_my_routerinfo(); @@ -407,8 +407,8 @@ void router_dirport_found_reachable(void) { /** Our router has just moved to a new IP. Reset stats. */ void server_has_changed_ip(void) { stats_n_seconds_working = 0; -// can_reach_or_port = 0; -// can_reach_dir_port = 0; + can_reach_or_port = 0; + can_reach_dir_port = 0; mark_my_descriptor_dirty(); } -- 2.11.4.GIT