From aa212b173c340536eb94b4978174b068ead89cb1 Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Thu, 14 Jun 2012 18:01:22 +0300 Subject: Remove validate_pluggable_transports_config(): redundant since 9d9b5ed0. The warning message of validate_pluggable_transports_config() is superseded by the changes in the warning message of connection_or_connect() when the proxy credentials can't be found. --- changes/bug5589 | 3 +++ src/or/circuitbuild.c | 28 ---------------------------- src/or/circuitbuild.h | 2 -- src/or/connection_or.c | 7 ++++--- src/or/main.c | 9 --------- 5 files changed, 7 insertions(+), 42 deletions(-) create mode 100644 changes/bug5589 diff --git a/changes/bug5589 b/changes/bug5589 new file mode 100644 index 000000000..cbcaaa75f --- /dev/null +++ b/changes/bug5589 @@ -0,0 +1,3 @@ + o Code simplifications and refactoring: + - Remove validate_pluggable_transports_config(): its warning + message is now handled by connection_or_connect(). diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 3ab72e4b8..807738b78 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -4795,34 +4795,6 @@ transport_add_from_config(const tor_addr_t *addr, uint16_t port, } } -/** Warn the user of possible pluggable transport misconfiguration. - * Return 0 if the validation happened, -1 if we should postpone the - * validation. */ -int -validate_pluggable_transports_config(void) -{ - /* Don't validate if managed proxies are not yet fully configured. */ - if (!bridge_list || pt_proxies_configuration_pending()) - return -1; - - SMARTLIST_FOREACH_BEGIN(bridge_list, const bridge_info_t *, b) { - /* Skip bridges without transports. */ - if (!b->transport_name) - continue; - /* See if the user has Bridges that specify nonexistent - pluggable transports. We should warn the user in such case, - since it's probably misconfiguration. */ - if (!transport_get_by_name(b->transport_name)) - log_warn(LD_CONFIG, "We can't find a pluggable transport proxy " - "that supports '%s' for bridge '%s:%u'. This can happen " - "if you haven't provided a ClientTransportPlugin line, or " - "if your pluggable transport proxy stopped working.", - b->transport_name, fmt_addr(&b->addr), b->port); - } SMARTLIST_FOREACH_END(b); - - return 0; -} - /** Return a bridge pointer if ri is one of our known bridges * (either by comparing keys if possible, else by comparing addr/port). * Else return NULL. */ diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h index 5b7739903..72ce8ef15 100644 --- a/src/or/circuitbuild.h +++ b/src/or/circuitbuild.h @@ -166,7 +166,5 @@ int find_transport_by_bridge_addrport(const tor_addr_t *addr, uint16_t port, const transport_t **transport); transport_t *transport_get_by_name(const char *name); -int validate_pluggable_transports_config(void); - #endif diff --git a/src/or/connection_or.c b/src/or/connection_or.c index cbb1110c6..467e169d7 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -1085,9 +1085,10 @@ connection_or_connect(const tor_addr_t *_addr, uint16_t port, if (transport_name) { log_warn(LD_GENERAL, "We were supposed to connect to bridge '%s:%u' " - "using pluggable transport '%s', but it seems that we can't " - "find a pluggable transport proxy supporting '%s'. Please make " - "sure that your configuration file is valid.", + "using pluggable transport '%s', but we can't find a pluggable " + "transport proxy supporting '%s'. This can happen if you " + "haven't provided a ClientTransportPlugin line, or if " + "your pluggable transport proxy stopped running.", fmt_addr(&TO_CONN(conn)->addr), TO_CONN(conn)->port, transport_name, transport_name); } else { diff --git a/src/or/main.c b/src/or/main.c index 163dd5d0f..5ede4b860 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1118,7 +1118,6 @@ run_scheduled_events(time_t now) static int should_init_bridge_stats = 1; static time_t time_to_retry_dns_init = 0; static time_t time_to_next_heartbeat = 0; - static int has_validated_pt = 0; const or_options_t *options = get_options(); int is_server = server_mode(options); @@ -1526,14 +1525,6 @@ run_scheduled_events(time_t now) if (!net_is_disabled() && pt_proxies_configuration_pending()) pt_configure_remaining_proxies(); - /** 11c. validate pluggable transports configuration if we need to */ - if (!has_validated_pt && - (options->Bridges || options->ClientTransportPlugin)) { - if (validate_pluggable_transports_config() == 0) { - has_validated_pt = 1; - } - } - /** 12. write the heartbeat message */ if (options->HeartbeatPeriod && time_to_next_heartbeat <= now) { -- cgit v1.2.3