diff options
author | Roger Dingledine <arma@torproject.org> | 2006-07-18 00:59:46 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2006-07-18 00:59:46 +0000 |
commit | 388ac4126a1fbd95dec063eec2740bb7ebf1cfa3 (patch) | |
tree | 46a5cfee345f134d603c99fd39c23c5d7a1cc92e /src/or/circuituse.c | |
parent | a8444c6f53b22387ee86c50e899fd04b6f826659 (diff) | |
download | tor-388ac4126a1fbd95dec063eec2740bb7ebf1cfa3.tar.gz tor-388ac4126a1fbd95dec063eec2740bb7ebf1cfa3.zip |
If we are using an exit enclave and we can't connect, e.g. because
its webserver is misconfigured to not listen on localhost, then back
off and try connecting from somewhere else before we fail.
svn:r6783
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r-- | src/or/circuituse.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c index b6ceafd700..0c7198a7bf 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -963,10 +963,16 @@ circuit_get_open_circ_or_launch(connection_t *conn, if (desired_circuit_purpose == CIRCUIT_PURPOSE_C_GENERAL) { if (conn->chosen_exit_name) { routerinfo_t *r; + int opt = conn->chosen_exit_optional; if (!(r = router_get_by_nickname(conn->chosen_exit_name, 1))) { - log_notice(LD_APP, - "Requested exit point '%s' is not known. Closing.", - conn->chosen_exit_name); + log_fn(opt ? LOG_INFO : LOG_WARN, LD_APP, + "Requested exit point '%s' is not known. %s.", + conn->chosen_exit_name, opt ? "Trying others" : "Closing"); + if (opt) { + conn->chosen_exit_optional = 0; + tor_free(conn->chosen_exit_name); + return 0; + } return -1; } extend_info = extend_info_from_router(r); @@ -1151,16 +1157,27 @@ connection_ap_handshake_attach_circuit(connection_t *conn) if (conn->chosen_exit_name) { routerinfo_t *router = router_get_by_nickname(conn->chosen_exit_name, 1); + int opt = conn->chosen_exit_optional; if (!router) { - log_warn(LD_APP, - "Requested exit point '%s' is not known. Closing.", - conn->chosen_exit_name); + log_fn(opt ? LOG_INFO : LOG_WARN, LD_APP, + "Requested exit point '%s' is not known. %s.", + conn->chosen_exit_name, opt ? "Trying others" : "Closing"); + if (opt) { + conn->chosen_exit_optional = 0; + tor_free(conn->chosen_exit_name); + return 0; + } return -1; } if (!connection_ap_can_use_exit(conn, router)) { - log_warn(LD_APP, - "Requested exit point '%s' would refuse request. Closing.", - conn->chosen_exit_name); + log_fn(opt ? LOG_INFO : LOG_WARN, LD_APP, + "Requested exit point '%s' would refuse request. %s.", + conn->chosen_exit_name, opt ? "Trying others" : "Closing"); + if (opt) { + conn->chosen_exit_optional = 0; + tor_free(conn->chosen_exit_name); + return 0; + } return -1; } } |