diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index bd06d31070..7338e24308 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -4722,9 +4722,10 @@ transport_resolve_conflicts(transport_t *t) int transport_add(transport_t *t) { + int r; tor_assert(t); - int r = transport_resolve_conflicts(t); + r = transport_resolve_conflicts(t); switch (r) { case 0: /* should register transport */ @@ -5016,7 +5017,6 @@ fetch_bridge_descriptors(or_options_t *options, time_t now) if (!bridge_list) return; - /* ASN Should we move this to launch_direct_bridge_descriptor_fetch() ? */ /* If we still have unconfigured managed proxies, don't go and connect to a bridge. */ if (pt_proxies_configuration_pending()) diff --git a/src/or/config.c b/src/or/config.c index 79c1b1e199..d36418b0d5 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1226,11 +1226,6 @@ options_act(or_options_t *old_options) sweep_bridge_list(); } - /* If we have pluggable transport related options enabled, see if we - should warn the user about potential configuration problems. */ - if (options->Bridges || options->ClientTransportPlugin) - validate_pluggable_transports_config(); - if (running_tor && rend_config_services(options, 0)<0) { log_warn(LD_BUG, "Previously validated hidden services line could not be added!"); @@ -1277,6 +1272,11 @@ options_act(or_options_t *old_options) sweep_transport_list(); sweep_proxy_list(); + /* If we have pluggable transport related options enabled, see if we + should warn the user about potential configuration problems. */ + if (options->Bridges || options->ClientTransportPlugin) + validate_pluggable_transports_config(); + /* Bail out at this point if we're not going to be a client or server: * we want to not fork, and to log stuff to stderr. */ if (!running_tor) @@ -5820,7 +5820,7 @@ get_transport_in_state_by_name(const char *transport) /** Return string containing the address:port part of the * TransportProxy line for transport transport. * If the line is corrupted, return NULL. */ -const char * +static const char * get_transport_bindaddr(const char *line, const char *transport) { char *line_tmp = NULL; diff --git a/src/or/transports.c b/src/or/transports.c index 91ff5184a7..1b7249fae2 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -13,7 +13,6 @@ #include "transports.h" #include "util.h" -/* ASN TIDY THESE UP*/ static void set_managed_proxy_environment(char ***envp, const managed_proxy_t *mp); static INLINE int proxy_configuration_finished(const managed_proxy_t *mp); @@ -372,11 +371,16 @@ register_server_proxy(managed_proxy_t *mp) tor_assert(mp->conf_state != PT_PROTO_COMPLETED); SMARTLIST_FOREACH_BEGIN(mp->transports, transport_t *, t) { - save_transport_to_state(t->name,&t->addr,t->port); /* pass tor_addr_t? */ + save_transport_to_state(t->name, &t->addr, t->port); smartlist_add(sm_tmp, tor_strdup(t->name)); } SMARTLIST_FOREACH_END(t); + /* Since server proxies don't register their transports in the + circuitbuild.c subsystem, it's our duty to free them when we + switch mp->transports to strings. */ + SMARTLIST_FOREACH(mp->transports, transport_t *, t, transport_free(t)); smartlist_free(mp->transports); + mp->transports = sm_tmp; } @@ -438,7 +442,6 @@ managed_proxy_destroy(managed_proxy_t *mp) SMARTLIST_FOREACH(mp->transports_to_launch, char *, t, tor_free(t)); /* free the transports smartlist */ - smartlist_clear(mp->transports_to_launch); smartlist_free(mp->transports_to_launch); /* remove it from the list of managed proxies */ @@ -469,8 +472,12 @@ handle_finished_proxy(managed_proxy_t *mp) register_proxy(mp); /* register transports */ mp->conf_state = PT_PROTO_COMPLETED; /* mark it as completed. */ break; + case PT_PROTO_INFANT: + case PT_PROTO_LAUNCHED: + case PT_PROTO_ACCEPTING_METHODS: + case PT_PROTO_COMPLETED: default: - log_warn(LD_CONFIG, "Unfinished managed proxy in " + log_warn(LD_CONFIG, "Unexpected managed proxy state in " "handle_finished_proxy()."); tor_assert(0); } @@ -891,6 +898,7 @@ void pt_kickstart_proxy(const char *transport, char **proxy_argv, int is_server) { managed_proxy_t *mp=NULL; + transport_t *old_transport = NULL; mp = get_managed_proxy_by_argv_and_type(proxy_argv, is_server); @@ -911,7 +919,6 @@ pt_kickstart_proxy(const char *transport, char **proxy_argv, int is_server) unconfigured_proxies_n++; } - transport_t *old_transport = NULL; old_transport = transport_get_by_name(transport); if (old_transport) old_transport->marked_for_removal = 0;