aboutsummaryrefslogtreecommitdiff
path: root/src/or/statefile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/statefile.c')
-rw-r--r--src/or/statefile.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/or/statefile.c b/src/or/statefile.c
index dd9d10230f..001c4c3c4b 100644
--- a/src/or/statefile.c
+++ b/src/or/statefile.c
@@ -553,8 +553,7 @@ save_transport_to_state(const char *transport,
if (transport_line) { /* if transport already exists in state... */
const char *prev_bindaddr = /* get its addrport... */
get_transport_bindaddr(transport_line->value, transport);
- tor_asprintf(&transport_addrport, "%s:%d", fmt_and_decorate_addr(addr),
- (int)port);
+ transport_addrport = tor_strdup(fmt_addrport(addr, port));
/* if transport in state has the same address as this one, life is good */
if (!strcmp(prev_bindaddr, transport_addrport)) {
@@ -566,9 +565,9 @@ save_transport_to_state(const char *transport,
"address:port. Let's update the state file with the new "
"address:port");
tor_free(transport_line->value); /* free the old line */
- tor_asprintf(&transport_line->value, "%s %s:%d", transport,
- fmt_and_decorate_addr(addr),
- (int) port); /* replace old addrport line with new line */
+ /* replace old addrport line with new line */
+ tor_asprintf(&transport_line->value, "%s %s", transport,
+ fmt_addrport(addr, port));
}
} else { /* never seen this one before; save it in state for next time */
log_info(LD_CONFIG, "It's the first time we see this transport. "
@@ -585,8 +584,7 @@ save_transport_to_state(const char *transport,
/* allocate space for the new line and fill it in */
*next = line = tor_malloc_zero(sizeof(config_line_t));
line->key = tor_strdup("TransportProxy");
- tor_asprintf(&line->value, "%s %s:%d", transport,
- fmt_and_decorate_addr(addr), (int) port);
+ tor_asprintf(&line->value, "%s %s", transport, fmt_addrport(addr, port));
next = &(line->next);
}