diff options
author | Daniel Stenberg <daniel@haxx.se> | 2006-05-03 06:11:44 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2006-05-03 06:11:44 +0000 |
commit | 22e34b53e493e7f94036182ad2c6764bdc3ac5fb (patch) | |
tree | 3ae220ae061f6814386fd2650007147c9c485d9c /ares_init.c | |
parent | 772811b915392014886d2361bcfe58e9655edf7f (diff) | |
download | c-ares-22e34b53e493e7f94036182ad2c6764bdc3ac5fb.tar.gz c-ares-22e34b53e493e7f94036182ad2c6764bdc3ac5fb.tar.bz2 c-ares-22e34b53e493e7f94036182ad2c6764bdc3ac5fb.zip |
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.
Diffstat (limited to 'ares_init.c')
-rw-r--r-- | ares_init.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ares_init.c b/ares_init.c index a6a6723..2f320a2 100644 --- a/ares_init.c +++ b/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) |