mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 05:03:43 +01:00
bridge: Always put transport-info line
Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
1941f25f4c
commit
d587ba01a7
@ -1798,20 +1798,21 @@ pt_get_extra_info_descriptor_string(void)
|
||||
|
||||
/* Set transport-info line. */
|
||||
{
|
||||
char *transport_info_args = NULL;
|
||||
char *version = NULL;
|
||||
char *impl = NULL;
|
||||
|
||||
if (mp->version) {
|
||||
tor_asprintf(&transport_info_args, " version=%s", mp->version);
|
||||
tor_asprintf(&version, " version=%s", mp->version);
|
||||
}
|
||||
if (mp->implementation) {
|
||||
tor_asprintf(&transport_info_args, " implementation=%s",
|
||||
mp->implementation);
|
||||
}
|
||||
if (transport_info_args) {
|
||||
smartlist_add_asprintf(string_chunks, "transport-info%s",
|
||||
transport_info_args ? transport_info_args : "");
|
||||
tor_free(transport_info_args);
|
||||
tor_asprintf(&impl, " implementation=%s", mp->implementation);
|
||||
}
|
||||
/* Always put in the line even if empty. Else, we don't know to which
|
||||
* transport this applies to. */
|
||||
smartlist_add_asprintf(string_chunks, "transport-info%s%s",
|
||||
version ? version: "", impl ? impl: "");
|
||||
tor_free(version);
|
||||
tor_free(impl);
|
||||
}
|
||||
} SMARTLIST_FOREACH_END(mp);
|
||||
|
||||
|
@ -413,7 +413,9 @@ test_pt_get_extrainfo_string(void *arg)
|
||||
tt_assert(s);
|
||||
tt_str_op(s, OP_EQ,
|
||||
"transport hagbard 127.0.0.1:5555\n"
|
||||
"transport celine 127.0.0.1:1723 card=no-enemy\n");
|
||||
"transport-info\n"
|
||||
"transport celine 127.0.0.1:1723 card=no-enemy\n"
|
||||
"transport-info\n");
|
||||
|
||||
done:
|
||||
/* XXXX clean up better */
|
||||
|
Loading…
Reference in New Issue
Block a user