aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2012-04-12 01:35:46 +0200
committerGeorge Kadianakis <desnacked@riseup.net>2012-04-12 01:35:46 +0200
commit32267809b529a636e556be4b42630bfc56a61fb5 (patch)
tree907cb8b22f6a9896ae3c24186804b597701ed73e
parent9d9b5ed0c65e2c6669a047706122b650f16870cb (diff)
downloadtor-32267809b529a636e556be4b42630bfc56a61fb5.tar
tor-32267809b529a636e556be4b42630bfc56a61fb5.tar.gz
Trivially refactor validate_pluggable_transports_config().
* Remove the ugly if statement. * constify 'bridge_info_t' in SMARTLIST_FOREACH_BEGIN.
-rw-r--r--src/or/circuitbuild.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 359771ea8..5481838cc 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -4793,26 +4793,25 @@ int
validate_pluggable_transports_config(void)
{
/* Don't validate if managed proxies are not yet fully configured. */
- if (bridge_list && !pt_proxies_configuration_pending()) {
- SMARTLIST_FOREACH_BEGIN(bridge_list, 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;
- } else {
+ 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 <b>ri</b> is one of our known bridges