summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sock.c11
-rw-r--r--src/sock.h2
2 files changed, 8 insertions, 5 deletions
diff --git a/src/sock.c b/src/sock.c
index cefafd9..eefd75c 100644
--- a/src/sock.c
+++ b/src/sock.c
@@ -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);
diff --git a/src/sock.h b/src/sock.h
index b85142c..0755e15 100644
--- a/src/sock.h
+++ b/src/sock.h
@@ -51,7 +51,7 @@ union sockaddr_union {
};
extern int init_sock(void);
-extern void destroy_dock(void);
+extern void cleanup_dock(void);
extern int opensock (const char *host, int port, const char *bind_to, const char *bind_to_alt);
extern int listen_sock (const char *addr, uint16_t port, sblist* listen_fds);