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 | dd06c60ada039faafd937a136e3dc7ff9c41159a (patch) | |
tree | 5e5337faa1571a343b4c643da651ca817afc7802 /ares/ares_init.c | |
parent | 6ca627ae742816cfca67d7e2ad3b59c269e5651d (diff) |
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/ares_init.c')
-rw-r--r-- | ares/ares_init.c | 6 |
1 files changed, 6 insertions, 0 deletions
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) |