aboutsummaryrefslogtreecommitdiff
path: root/ares/ares_init.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-12-04 12:53:03 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-12-04 12:53:03 +0000
commite5b0533dabe4b67dc9851b86e2ca4d9846899bd2 (patch)
tree419097734f43f890c642217d0ab219d8e1b8c089 /ares/ares_init.c
parenta2a315a6e850c9812e0beb51b9f84b5b4f9e8919 (diff)
Gregor Jasny provided the patch that introduces ares_set_socket_callback(),
and I edited it to also get duped by ares_dup().
Diffstat (limited to 'ares/ares_init.c')
-rw-r--r--ares/ares_init.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/ares/ares_init.c b/ares/ares_init.c
index faa41581b..e8d9ab1d0 100644
--- a/ares/ares_init.c
+++ b/ares/ares_init.c
@@ -159,6 +159,8 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
channel->servers = NULL;
channel->sock_state_cb = NULL;
channel->sock_state_cb_data = NULL;
+ channel->sock_create_cb = NULL;
+ channel->sock_create_cb_data = NULL;
channel->last_server = 0;
channel->last_timeout_processed = (time_t)now.tv_sec;
@@ -283,8 +285,9 @@ int ares_dup(ares_channel *dest, ares_channel src)
return rc;
/* Now clone the options that ares_save_options() doesn't support. */
+ (*dest)->sock_create_cb = src->sock_create_cb;
+ (*dest)->sock_create_cb_data = src->sock_create_cb_data;
- /* No such options available yet */
return ARES_SUCCESS; /* everything went fine */
@@ -1551,3 +1554,11 @@ unsigned short ares__generate_new_id(rc4_key* key)
ares__rc4(key, (unsigned char *)&r, sizeof(r));
return r;
}
+
+void ares_set_socket_callback(ares_channel channel,
+ ares_sock_create_callback cb,
+ void *data)
+{
+ channel->sock_create_cb = cb;
+ channel->sock_create_cb_data = data;
+}