diff options
author | David Fifield <david@bamsoftware.com> | 2012-10-06 21:25:25 -0700 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-10-10 22:25:30 -0400 |
commit | 8419d184411e8cd9457346a7a3d5f9734211a8b2 (patch) | |
tree | d97f5e28e33089a948ca958253bdd86aa9b3ab13 /src/or/transports.c | |
parent | 78e2d8c7a85c8ec2defe5d1873ae19ba9b82b14c (diff) | |
download | tor-8419d184411e8cd9457346a7a3d5f9734211a8b2.tar.gz tor-8419d184411e8cd9457346a7a3d5f9734211a8b2.zip |
Use fmt_addrport where appropriate.
This is mostly a conversion from this pattern:
log("... %s:%d ...", fmt_and_decorate_addr(&addr), port);
to this:
log("... %s ...", fmt_addrport(&addr, port));
The output is the same in all cases.
Diffstat (limited to 'src/or/transports.c')
-rw-r--r-- | src/or/transports.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/or/transports.c b/src/or/transports.c index ed4a295c72..56ab6005f0 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -270,24 +270,26 @@ transport_resolve_conflicts(const transport_t *t) t_tmp->marked_for_removal = 0; return 1; } else { /* same name but different addrport */ - char *new_transport_addr = tor_strdup(fmt_and_decorate_addr(&t->addr)); + char *new_transport_addrport = + tor_strdup(fmt_addrport(&t->addr, t->port)); if (t_tmp->marked_for_removal) { /* marked for removal */ - log_notice(LD_GENERAL, "You tried to add transport '%s' at '%s:%u' " + log_notice(LD_GENERAL, "You tried to add transport '%s' at '%s' " "but there was already a transport marked for deletion at " - "'%s:%u'. We deleted the old transport and registered the " - "new one.", t->name, new_transport_addr, t->port, - fmt_and_decorate_addr(&t_tmp->addr), t_tmp->port); + "'%s'. We deleted the old transport and registered the " + "new one.", t->name, new_transport_addrport, + fmt_addrport(&t_tmp->addr, t_tmp->port)); smartlist_remove(transport_list, t_tmp); transport_free(t_tmp); - tor_free(new_transport_addr); + tor_free(new_transport_addrport); } else { /* *not* marked for removal */ - log_notice(LD_GENERAL, "You tried to add transport '%s' at '%s:%u' " - "but the same transport already exists at '%s:%u'. " - "Skipping.", t->name, new_transport_addr, t->port, - fmt_and_decorate_addr(&t_tmp->addr), t_tmp->port); - tor_free(new_transport_addr); + log_notice(LD_GENERAL, "You tried to add transport '%s' at '%s' " + "but the same transport already exists at '%s'. " + "Skipping.", t->name, new_transport_addrport, + fmt_addrport(&t_tmp->addr, t_tmp->port)); + tor_free(new_transport_addrport); return -1; } + tor_free(new_transport_addrport); } } @@ -332,18 +334,18 @@ transport_add_from_config(const tor_addr_t *addr, uint16_t port, switch (r) { case -1: default: - log_notice(LD_GENERAL, "Could not add transport %s at %s:%u. Skipping.", - t->name, fmt_and_decorate_addr(&t->addr), t->port); + log_notice(LD_GENERAL, "Could not add transport %s at %s. Skipping.", + t->name, fmt_addrport(&t->addr, t->port)); transport_free(t); return -1; case 1: - log_info(LD_GENERAL, "Succesfully registered transport %s at %s:%u.", - t->name, fmt_and_decorate_addr(&t->addr), t->port); + log_info(LD_GENERAL, "Succesfully registered transport %s at %s.", + t->name, fmt_addrport(&t->addr, t->port)); transport_free(t); /* falling */ return 0; case 0: - log_info(LD_GENERAL, "Succesfully registered transport %s at %s:%u.", - t->name, fmt_and_decorate_addr(&t->addr), t->port); + log_info(LD_GENERAL, "Succesfully registered transport %s at %s.", + t->name, fmt_addrport(&t->addr, t->port)); return 0; } } @@ -644,8 +646,8 @@ register_server_proxy(const managed_proxy_t *mp) SMARTLIST_FOREACH_BEGIN(mp->transports, transport_t *, t) { save_transport_to_state(t->name, &t->addr, t->port); - log_notice(LD_GENERAL, "Registered server transport '%s' at '%s:%d'", - t->name, fmt_and_decorate_addr(&t->addr), (int)t->port); + log_notice(LD_GENERAL, "Registered server transport '%s' at '%s'", + t->name, fmt_addrport(&t->addr, t->port)); } SMARTLIST_FOREACH_END(t); } |