[tor-commits] [tor/master] Document some transports.c behaviors and assumptions

nickm at torproject.org nickm at torproject.org
Mon May 7 15:06:41 UTC 2012


commit 9ceec869b5901776285e72d659faa9ba67b80faa
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon May 7 09:55:14 2012 -0400

    Document some transports.c behaviors and assumptions
---
 src/or/transports.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/or/transports.c b/src/or/transports.c
index b8b2331..09fd69b 100644
--- a/src/or/transports.c
+++ b/src/or/transports.c
@@ -1034,8 +1034,11 @@ create_managed_proxy_environment(const managed_proxy_t *mp)
 }
 
 /** Create and return a new managed proxy for <b>transport</b> using
- *  <b>proxy_argv</b>. If <b>is_server</b> is true, it's a server
- *  managed proxy. */
+ *  <b>proxy_argv</b>.  Also, add it to the global managed proxy list. If
+ *  <b>is_server</b> is true, it's a server managed proxy.  Takes ownership of
+ *  <b>proxy_argv</b>.
+ *
+ * Requires that proxy_argv have at least one element. */
 static managed_proxy_t *
 managed_proxy_create(const smartlist_t *transport_list,
                      char **proxy_argv, int is_server)
@@ -1063,7 +1066,13 @@ managed_proxy_create(const smartlist_t *transport_list,
 
 /** Register proxy with <b>proxy_argv</b>, supporting transports in
  *  <b>transport_list</b>, to the managed proxy subsystem.
- *  If <b>is_server</b> is true, then the proxy is a server proxy. */
+ *  If <b>is_server</b> is true, then the proxy is a server proxy.
+ *
+ * Takes ownership of proxy_argv.
+ *
+ * Requires that proxy_argv be a NULL-terminated array of command-line
+ * elements, containing at least one element.
+ **/
 void
 pt_kickstart_proxy(const smartlist_t *transport_list,
                    char **proxy_argv, int is_server)
@@ -1071,6 +1080,10 @@ pt_kickstart_proxy(const smartlist_t *transport_list,
   managed_proxy_t *mp=NULL;
   transport_t *old_transport = NULL;
 
+  if (!proxy_argv || !proxy_argv[0]) {
+    return;
+  }
+
   mp = get_managed_proxy_by_argv_and_type(proxy_argv, is_server);
 
   if (!mp) { /* we haven't seen this proxy before */





More information about the tor-commits mailing list