From e5b0533dabe4b67dc9851b86e2ca4d9846899bd2 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 4 Dec 2008 12:53:03 +0000 Subject: Gregor Jasny provided the patch that introduces ares_set_socket_callback(), and I edited it to also get duped by ares_dup(). --- ares/ares_init.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'ares/ares_init.c') 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; +} -- cgit v1.2.3