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/connection.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/connection.c')
-rw-r--r-- | src/or/connection.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index b5c4a204a9..d559da5dd0 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -904,9 +904,8 @@ connection_listener_new(const struct sockaddr *listensockaddr, tor_addr_from_sockaddr(&addr, listensockaddr, &usePort); - log_notice(LD_NET, "Opening %s on %s:%d", - conn_type_to_string(type), fmt_and_decorate_addr(&addr), - usePort); + log_notice(LD_NET, "Opening %s on %s", + conn_type_to_string(type), fmt_addrport(&addr, usePort)); s = tor_open_socket(tor_addr_family(&addr), is_tcp ? SOCK_STREAM : SOCK_DGRAM, @@ -1512,17 +1511,17 @@ connection_proxy_connect(connection_t *conn, int type) } if (base64_authenticator) { - const char *addr = fmt_and_decorate_addr(&conn->addr); - tor_snprintf(buf, sizeof(buf), "CONNECT %s:%d HTTP/1.1\r\n" - "Host: %s:%d\r\n" + const char *addrport = fmt_addrport(&conn->addr, conn->port); + tor_snprintf(buf, sizeof(buf), "CONNECT %s HTTP/1.1\r\n" + "Host: %s\r\n" "Proxy-Authorization: Basic %s\r\n\r\n", - addr, conn->port, - addr, conn->port, + addrport, + addrport, base64_authenticator); tor_free(base64_authenticator); } else { - tor_snprintf(buf, sizeof(buf), "CONNECT %s:%d HTTP/1.0\r\n\r\n", - fmt_and_decorate_addr(&conn->addr), conn->port); + tor_snprintf(buf, sizeof(buf), "CONNECT %s HTTP/1.0\r\n\r\n", + fmt_addrport(&conn->addr, conn->port)); } connection_write_to_buf(buf, strlen(buf), conn); @@ -4235,11 +4234,10 @@ log_failed_proxy_connection(connection_t *conn) return; /* if we have no proxy set up, leave this function. */ log_warn(LD_NET, - "The connection to the %s proxy server at %s:%u just failed. " + "The connection to the %s proxy server at %s just failed. " "Make sure that the proxy server is up and running.", proxy_type_to_string(get_proxy_type()), - fmt_and_decorate_addr(&proxy_addr), - proxy_port); + fmt_addrport(&proxy_addr, proxy_port)); } /** Return string representation of <b>proxy_type</b>. */ |