summaryrefslogtreecommitdiff
path: root/src/Socket.cc
diff options
context:
space:
mode:
authorNicolas 'Pixel' Noble <pixel@nobis-crew.org>2013-01-17 00:03:31 -0800
committerNicolas 'Pixel' Noble <pixel@nobis-crew.org>2013-01-17 00:21:08 -0800
commitbca0857db0dd362805572316d03b327629cfc414 (patch)
treef34ea27ea1f11ad372f881cd4e92e7f77afc233c /src/Socket.cc
parent9c245e80a1076735bfe4c5c9d58d1ab242d4bd77 (diff)
Slightly changing the resolution error message; plus that condition was stupid.
Diffstat (limited to 'src/Socket.cc')
-rw-r--r--src/Socket.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/Socket.cc b/src/Socket.cc
index 6df1988..ccd1011 100644
--- a/src/Socket.cc
+++ b/src/Socket.cc
@@ -325,13 +325,12 @@ bool Balau::Socket::setLocal(const char * hostname, int port) {
DNSRequest req = resolveName(hostname, NULL, &hints);
struct addrinfo * res = req.res;
if (req.error != 0) {
- freeaddrinfo(res);
- return false;
- }
- if (!res) {
- freeaddrinfo(res);
+ Printer::elog(E_SOCKET, "Got a resolution error for host %s: %s (%i)", hostname, gai_strerror(req.error), req.error);
+ if (res)
+ freeaddrinfo(res);
return false;
}
+ IAssert(res, "That really shouldn't happen...");
EAssert(res->ai_family == AF_INET6, "getaddrinfo returned a familiy which isn't AF_INET6; %i", res->ai_family);
EAssert(res->ai_protocol == IPPROTO_TCP, "getaddrinfo returned a protocol which isn't IPPROTO_TCP; %i", res->ai_protocol);
EAssert(res->ai_addrlen == sizeof(sockaddr_in6), "getaddrinfo returned an addrlen which isn't that of sizeof(sockaddr_in6); %i", res->ai_addrlen);
@@ -376,13 +375,12 @@ bool Balau::Socket::connect(const char * hostname, int port) {
DNSRequest req = resolveName(hostname, NULL, &hints);
struct addrinfo * res = req.res;
if (req.error != 0) {
- freeaddrinfo(res);
- return false;
- }
- if (!res) {
- freeaddrinfo(res);
+ Printer::elog(E_SOCKET, "Got a resolution error for host %s: %s (%i)", hostname, gai_strerror(req.error), req.error);
+ if (res)
+ freeaddrinfo(res);
return false;
}
+ IAssert(res, "That really shouldn't happen...");
Printer::elog(E_SOCKET, "Got a resolution answer");
EAssert(res->ai_family == AF_INET6, "getaddrinfo returned a familiy which isn't AF_INET6; %i", res->ai_family);
EAssert(res->ai_protocol == IPPROTO_TCP, "getaddrinfo returned a protocol which isn't IPPROTO_TCP; %i", res->ai_protocol);