From b7e5574a3a3c5d2a8f9bf09de376e88be4364bcc Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 30 Jul 2015 12:25:52 +0200 Subject: [PATCH] Log which addresses connection attempts are made against --- common/network/TcpSocket.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx index 684ff8b3..f51873c1 100644 --- a/common/network/TcpSocket.cxx +++ b/common/network/TcpSocket.cxx @@ -169,6 +169,7 @@ TcpSocket::TcpSocket(const char *host, int port) int family; vnc_sockaddr_t sa; socklen_t salen; + char ntop[NI_MAXHOST]; family = current->ai_family; @@ -193,6 +194,9 @@ TcpSocket::TcpSocket(const char *host, int port) else sa.u.sin6.sin6_port = htons(port); + getnameinfo(&sa.u.sa, salen, ntop, sizeof(ntop), NULL, 0, NI_NUMERICHOST); + vlog.debug("Connecting to %s [%s] port %d", host, ntop, port); + sock = socket (family, SOCK_STREAM, 0); if (sock == -1) { err = errorNumber; @@ -207,6 +211,8 @@ TcpSocket::TcpSocket(const char *host, int port) if (err == EINTR) continue; #endif + vlog.debug("Failed to connect to address %s port %d: %d", + ntop, port, err); closesocket(sock); sock = -1; break; -- 2.39.5