From dd06c60ada039faafd937a136e3dc7ff9c41159a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 3 May 2006 06:11:44 +0000 Subject: Nick Mathewson added the ARES_OPT_SOCK_STATE_CB option that when set makes c-ares call a callback on socket state changes. A better way than the ares_getsock() to get full control over the socket state. --- ares/ares_init.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ares/ares_init.c') diff --git a/ares/ares_init.c b/ares/ares_init.c index a6a672343..2f320a2fa 100644 --- a/ares/ares_init.c +++ b/ares/ares_init.c @@ -113,6 +113,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, channel->queries = NULL; channel->domains = NULL; channel->sortlist = NULL; + channel->sock_state_cb = NULL; /* Initialize configuration by each of the four sources, from highest * precedence to lowest. @@ -192,6 +193,11 @@ static int init_by_options(ares_channel channel, struct ares_options *options, channel->udp_port = options->udp_port; if ((optmask & ARES_OPT_TCP_PORT) && channel->tcp_port == -1) channel->tcp_port = options->tcp_port; + if ((optmask & ARES_OPT_SOCK_STATE_CB) && channel->sock_state_cb == NULL) + { + channel->sock_state_cb = options->sock_state_cb; + channel->sock_state_cb_data = options->sock_state_cb_data; + } /* Copy the servers, if given. */ if ((optmask & ARES_OPT_SERVERS) && channel->nservers == -1) -- cgit v1.2.3