tor_assert(tlschan);
tor_assert(addr_out);
- tor_assert(tlschan->conn);
- tor_addr_copy(addr_out, &(TO_CONN(tlschan->conn)->addr));
+ if (tlschan->conn) {
+ tor_addr_copy(addr_out, &(TO_CONN(tlschan->conn)->addr));
+ rv = 1;
+ } else tor_addr_make_unspec(addr_out);
- return 1;
+ return rv;
}
+/**
+ * Get the name of the pluggable transport used by a channel_tls_t.
+ *
+ * This implements the get_transport_name for channel_tls_t. If the
+ * channel uses a pluggable transport, copy its name to
+ * <b>transport_out</b> and return 0. If the channel did not use a
+ * pluggable transport, return -1. */
+
+static int
+channel_tls_get_transport_name_method(channel_t *chan, char **transport_out)
+{
+ channel_tls_t *tlschan = BASE_CHAN_TO_TLS(chan);
+
+ tor_assert(tlschan);
+ tor_assert(transport_out);
+ tor_assert(tlschan->conn);
+
+ if (!tlschan->conn->ext_or_transport)
+ return -1;
+
+ *transport_out = tor_strdup(tlschan->conn->ext_or_transport);
+ return 0;
+}
+
/**
* Get endpoint description of a channel_tls_t
*