summaryrefslogtreecommitdiff
path: root/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
commitf61fa37f40158cca871fdce5d4a546e8ba3f482a (patch)
tree7e2833594e756504e67e0123c4a479a9d7bb05bd /ares_init.c
parent20e7876430a4bd75f469602d34dcd6c315d0cc0f (diff)
downloadc-ares-f61fa37f40158cca871fdce5d4a546e8ba3f482a.tar.gz
c-ares-f61fa37f40158cca871fdce5d4a546e8ba3f482a.tar.bz2
c-ares-f61fa37f40158cca871fdce5d4a546e8ba3f482a.zip
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_init.c')
-rw-r--r--ares_init.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/ares_init.c b/ares_init.c
index faa4158..e8d9ab1 100644
--- a/ares_init.c
+++ b/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;
+}