From 3e3d10824f08fa2917f62a4c9c81e4e7ab3a9327 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 1 Nov 2008 18:35:19 +0000 Subject: - Carlo Contavalli added support for the glibc "rotate" option, as documented in man resolv.conf: causes round robin selection of nameservers from among those listed. This has the effect of spreading the query load among all listed servers, rather than having all clients try the first listed server first every time. You can enable it with ARES_OPT_ROTATE --- ares/ares_send.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ares/ares_send.c') diff --git a/ares/ares_send.c b/ares/ares_send.c index a5811d36d..be5478df2 100644 --- a/ares/ares_send.c +++ b/ares/ares_send.c @@ -95,7 +95,13 @@ void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, /* Initialize query status. */ query->try = 0; - query->server = 0; + + /* Choose the server to send the query to. If rotation is enabled, keep track + * of the next server we want to use. */ + query->server = channel->last_server; + if (channel->rotate == 1) + channel->last_server = (channel->last_server + 1) % channel->nservers; + for (i = 0; i < channel->nservers; i++) { query->server_info[i].skip_server = 0; -- cgit v1.2.3