diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-06-11 00:27:06 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-06-11 00:27:06 +0200 |
commit | 8f94fe5e547bb56d9f90b247eff1cf2c77d14a14 (patch) | |
tree | 9526812fabcaad0554fddc960e0a8725da272aa4 /src/sock.c | |
parent | e20f5cc3a49035f7b422f62fdbaad12dc123094a (diff) |
WIP: caresbuild
Diffstat (limited to 'src/sock.c')
-rw-r--r-- | src/sock.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -162,9 +162,11 @@ bind_socket_list (int sockfd, sblist *addresses, int family) int opensock (const char *host, int port, const char *bind_to, const char *bind_to_alt) { int sockfd, n; - struct ares_addrinfo hints, *res, *ressave; + struct ares_addrinfo *ressave; + struct ares_addrinfo_node *res; + struct ares_addrinfo_hints hints; char portstr[6]; - ares_channel *resolver = NULL; + ares_channel resolver = NULL; assert (host != NULL); assert (port > 0); @@ -190,7 +192,7 @@ int opensock (const char *host, int port, const char *bind_to, const char *bind_ snprintf (portstr, sizeof (portstr), "%d", port); - n = ares_getaddrinfo (host, portstr, &hints, &res); + n = ares_getaddrinfo (resolver, host, portstr, &hints, &ressave); if (n != 0) { log_message (LOG_ERR, "opensock: Could not retrieve address info for %s:%d: %s", host, port, get_gai_error (n)); @@ -200,7 +202,8 @@ int opensock (const char *host, int port, const char *bind_to, const char *bind_ log_message(LOG_INFO, "opensock: getaddrinfo returned for %s:%d", host, port); - ressave = res; + res = ressave->nodes; + do { sockfd = socket (res->ai_family, res->ai_socktype, res->ai_protocol); |