diff options
author | Rick Deist <dreckard@users.noreply.github.com> | 2018-03-17 20:10:04 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-03-17 20:44:14 +0100 |
commit | d95f3dc0b117b0677700dae8dd51145c9b6f2d08 (patch) | |
tree | f1f044908f412bc3a946f61fa611884c0ff1611b /lib/hostip.h | |
parent | fb4f568b1e090c884eb63c3419322b558a38138e (diff) | |
download | curl-d95f3dc0b117b0677700dae8dd51145c9b6f2d08.tar.gz |
resolve: add CURLOPT_DNS_SHUFFLE_ADDRESSES
This patch adds CURLOPT_DNS_SHUFFLE_ADDRESSES to explicitly request
shuffling of IP addresses returned for a hostname when there is more
than one. This is useful when the application knows that a round robin
approach is appropriate and is willing to accept the consequences of
potentially discarding some preference order returned by the system's
implementation.
Closes #1694
Diffstat (limited to 'lib/hostip.h')
-rw-r--r-- | lib/hostip.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/hostip.h b/lib/hostip.h index 298eeeee3..1de4bee8d 100644 --- a/lib/hostip.h +++ b/lib/hostip.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -182,6 +182,17 @@ struct Curl_dns_entry * Curl_fetch_addr(struct connectdata *conn, const char *hostname, int port); + +/* + * Curl_shuffle_addr() shuffles the order of addresses in a 'Curl_addrinfo' + * struct by re-linking its linked list. + * + * The addr argument should be the address of a pointer to the head node of a + * `Curl_addrinfo` list and it will be modified to point to the new head after + * shuffling. + */ +CURLcode Curl_shuffle_addr(struct Curl_easy *data, Curl_addrinfo **addr); + /* * Curl_cache_addr() stores a 'Curl_addrinfo' struct in the DNS cache. * |