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_private.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'ares/ares_private.h') diff --git a/ares/ares_private.h b/ares/ares_private.h index df51266dc..8d5af0817 100644 --- a/ares/ares_private.h +++ b/ares/ares_private.h @@ -176,13 +176,22 @@ struct ares_channeldata { /* Active queries */ struct query *queries; + + ares_sock_state_cb sock_state_cb; + void *sock_state_cb_data; }; void ares__send_query(ares_channel channel, struct query *query, time_t now); -void ares__close_sockets(struct server_state *server); +void ares__close_sockets(ares_channel channel, struct server_state *server); int ares__get_hostent(FILE *fp, int family, struct hostent **host); int ares__read_line(FILE *fp, char **buf, int *bufsize); +#define SOCK_STATE_CALLBACK(c, s, r, w) \ + do { \ + if ((c)->sock_state_cb) \ + (c)->sock_state_cb((c)->sock_state_cb_data, (s), (r), (w)); \ + } while (0) + #ifdef CURLDEBUG /* This is low-level hard-hacking memory leak tracking and similar. Using the libcurl lowlevel code from within library is ugly and only works when -- cgit v1.2.3