mirror of https://github.com/getdnsapi/getdns.git
max_udp_backoff should not be public
At least, not with this point release
This commit is contained in:
parent
eec6ec29dd
commit
8a2fc5f5a9
|
@ -379,6 +379,10 @@ no)
|
|||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_WITH(max-udp-backoff, AS_HELP_STRING([--with-max-udp-backoff=<number of queries>],
|
||||
[Set the maximum number of messages that can be sent to other upstreams before the upstream which has previously timed out will be tried again. (defaults to 1000)]),, [withval="1000"])
|
||||
AC_DEFINE_UNQUOTED([UDP_MAX_BACKOFF], [$withval], [Maximum number of queries an failed UDP upstream passes before it will retry])
|
||||
|
||||
#---- check for pthreads library
|
||||
AC_ARG_WITH(libpthread, AS_HELP_STRING([--without-libpthread],
|
||||
[Disable libpthread (default is autodetect)]),
|
||||
|
|
|
@ -93,6 +93,7 @@ static struct const_info consts_info[] = {
|
|||
{ 632, "GETDNS_CONTEXT_CODE_TLS_CA_FILE", GETDNS_CONTEXT_CODE_TLS_CA_FILE_TEXT },
|
||||
{ 633, "GETDNS_CONTEXT_CODE_TLS_CIPHER_LIST", GETDNS_CONTEXT_CODE_TLS_CIPHER_LIST_TEXT },
|
||||
{ 634, "GETDNS_CONTEXT_CODE_TLS_CURVES_LIST", GETDNS_CONTEXT_CODE_TLS_CURVES_LIST_TEXT },
|
||||
{ 699, "GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE", GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE_TEXT },
|
||||
{ 700, "GETDNS_CALLBACK_COMPLETE", GETDNS_CALLBACK_COMPLETE_TEXT },
|
||||
{ 701, "GETDNS_CALLBACK_CANCEL", GETDNS_CALLBACK_CANCEL_TEXT },
|
||||
{ 702, "GETDNS_CALLBACK_TIMEOUT", GETDNS_CALLBACK_TIMEOUT_TEXT },
|
||||
|
@ -176,6 +177,7 @@ static struct const_name_info consts_name_info[] = {
|
|||
{ "GETDNS_CONTEXT_CODE_HOSTS", 630 },
|
||||
{ "GETDNS_CONTEXT_CODE_IDLE_TIMEOUT", 617 },
|
||||
{ "GETDNS_CONTEXT_CODE_LIMIT_OUTSTANDING_QUERIES", 606 },
|
||||
{ "GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE", 699 },
|
||||
{ "GETDNS_CONTEXT_CODE_MEMORY_FUNCTIONS", 615 },
|
||||
{ "GETDNS_CONTEXT_CODE_NAMESPACES", 600 },
|
||||
{ "GETDNS_CONTEXT_CODE_PUBKEY_PINSET", 621 },
|
||||
|
|
|
@ -39,6 +39,14 @@
|
|||
#ifndef CONST_INFO_H_
|
||||
#define CONST_INFO_H_
|
||||
|
||||
#include "getdns/getdns.h"
|
||||
#include "getdns/getdns_extra.h"
|
||||
|
||||
#ifndef GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE
|
||||
#define GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE 699
|
||||
#define GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE_TEXT "Change related to getdns_context_set_max_backoff_value"
|
||||
#endif
|
||||
|
||||
struct const_info {
|
||||
int code;
|
||||
const char *name;
|
||||
|
|
|
@ -93,6 +93,7 @@ typedef unsigned short in_port_t;
|
|||
#ifdef USE_DANESSL
|
||||
# include "ssl_dane/danessl.h"
|
||||
#endif
|
||||
#include "const-info.h"
|
||||
|
||||
#define GETDNS_PORT_ZERO 0
|
||||
#define GETDNS_PORT_DNS 53
|
||||
|
@ -679,7 +680,7 @@ upstreams_create(getdns_context *context, size_t size)
|
|||
r->count = 0;
|
||||
r->current_udp = 0;
|
||||
r->current_stateful = 0;
|
||||
r->max_backoff_value = context->max_backoff_value;
|
||||
r->max_backoff_value = context->max_backoff_value;
|
||||
r->tls_backoff_time = context->tls_backoff_time;
|
||||
r->tls_connection_retries = context->tls_connection_retries;
|
||||
r->log = context->log;
|
||||
|
@ -1665,7 +1666,7 @@ getdns_context_create_with_extended_memory_functions(
|
|||
result->tls_backoff_time = 3600;
|
||||
result->tls_connection_retries = 2;
|
||||
result->limit_outstanding_queries = 0;
|
||||
result->max_backoff_value = 1000;
|
||||
result->max_backoff_value = UDP_MAX_BACKOFF;
|
||||
|
||||
/* unbound context is initialized here */
|
||||
/* Unbound needs SSL to be init'ed this early when TLS is used. However we
|
||||
|
@ -2364,9 +2365,15 @@ getdns_context_set_round_robin_upstreams(getdns_context *context, uint8_t value)
|
|||
return GETDNS_RETURN_GOOD;
|
||||
} /* getdns_context_set_round_robin_upstreams */
|
||||
|
||||
/*
|
||||
* getdns_context_set_max_backoff_value
|
||||
*
|
||||
/**
|
||||
* Set the maximum number of messages that can be sent to other upstreams
|
||||
* before the upstream which has previously timed out will be tried again.
|
||||
* @see getdns_context_get_max_backoff_value
|
||||
* @param[in] context The context to configure
|
||||
* @param[in[ value Number of messages sent to other upstreams before
|
||||
* retrying the upstream which had timed out.
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_INVALID_PARAMETER if context is null.
|
||||
*/
|
||||
getdns_return_t
|
||||
getdns_context_set_max_backoff_value(getdns_context *context, uint16_t value)
|
||||
|
@ -4398,6 +4405,16 @@ getdns_context_get_round_robin_upstreams(getdns_context *context,
|
|||
return GETDNS_RETURN_GOOD;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum number of messages that can be sent to other upstreams
|
||||
* before the upstream which has previously timed out will be tried again.
|
||||
* @see getdns_context_set_max_backoff_value
|
||||
* @param[in] context The context from which to get the setting
|
||||
* @param[out] value Number of messages sent to other upstreams before
|
||||
* retrying the upstream which had timed out.
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_INVALID_PARAMETER if context is null.
|
||||
*/
|
||||
getdns_return_t
|
||||
getdns_context_get_max_backoff_value(getdns_context *context,
|
||||
uint16_t* value) {
|
||||
|
|
|
@ -103,9 +103,6 @@ extern "C" {
|
|||
#define GETDNS_CONTEXT_CODE_TLS_CURVES_LIST 634
|
||||
#define GETDNS_CONTEXT_CODE_TLS_CURVES_LIST_TEXT "Change related to getdns_context_set_tls_curves_list"
|
||||
|
||||
#define GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE 635
|
||||
#define GETDNS_CONTEXT_CODE_MAX_BACKOFF_VALUE_TEXT "Change related to getdns_context_set_max_backoff_value"
|
||||
|
||||
/** @}
|
||||
*/
|
||||
|
||||
|
@ -771,20 +768,6 @@ getdns_return_t
|
|||
getdns_context_set_tls_curves_list(
|
||||
getdns_context *context, const char *curves_list);
|
||||
|
||||
/**
|
||||
* Set the maximum number of messages that can be sent to other upstreams
|
||||
* before the upstream which has previously timed out will be tried again.
|
||||
* @see getdns_context_get_max_backoff_value
|
||||
* @param[in] context The context to configure
|
||||
* @param[in[ value Number of messages sent to other upstreams before
|
||||
* retrying the upstream which had timed out.
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_INVALID_PARAMETER if context is null.
|
||||
*/
|
||||
getdns_return_t
|
||||
getdns_context_set_max_backoff_value(getdns_context *context, uint16_t value);
|
||||
|
||||
|
||||
/**
|
||||
* Get the current resolution type setting from this context.
|
||||
* @see getdns_context_set_resolution_type
|
||||
|
@ -1319,20 +1302,6 @@ getdns_return_t
|
|||
getdns_context_get_tls_curves_list(
|
||||
getdns_context *context, const char **curves_list);
|
||||
|
||||
/**
|
||||
* Get the maximum number of messages that can be sent to other upstreams
|
||||
* before the upstream which has previously timed out will be tried again.
|
||||
* @see getdns_context_set_max_backoff_value
|
||||
* @param[in] context The context from which to get the setting
|
||||
* @param[out] value Number of messages sent to other upstreams before
|
||||
* retrying the upstream which had timed out.
|
||||
* @return GETDNS_RETURN_GOOD on success
|
||||
* @return GETDNS_RETURN_INVALID_PARAMETER if context is null.
|
||||
*/
|
||||
getdns_return_t
|
||||
getdns_context_get_max_backoff_value(getdns_context *context,
|
||||
uint16_t* value);
|
||||
|
||||
/** @}
|
||||
*/
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ getdns_context_get_num_pending_requests
|
|||
getdns_context_get_resolution_type
|
||||
getdns_context_get_resolvconf
|
||||
getdns_context_get_round_robin_upstreams
|
||||
getdns_context_get_max_backoff_value
|
||||
getdns_context_get_suffix
|
||||
getdns_context_get_timeout
|
||||
getdns_context_get_tls_authentication
|
||||
|
@ -74,7 +73,6 @@ getdns_context_set_resolution_type
|
|||
getdns_context_set_resolvconf
|
||||
getdns_context_set_return_dnssec_status
|
||||
getdns_context_set_round_robin_upstreams
|
||||
getdns_context_set_max_backoff_value
|
||||
getdns_context_set_suffix
|
||||
getdns_context_set_timeout
|
||||
getdns_context_set_tls_authentication
|
||||
|
|
|
@ -14,7 +14,7 @@ cat > const-info.c << END_OF_HEAD
|
|||
static struct const_info consts_info[] = {
|
||||
{ -1, NULL, "/* <unknown getdns value> */" },
|
||||
END_OF_HEAD
|
||||
gawk '/^[ ]+GETDNS_[A-Z_]+[ ]+=[ ]+[0-9]+/{ key = sprintf("%7d", $3); consts[key] = $1; }/^#define GETDNS_[A-Z_]+[ ]+[0-9]+/ && !/^#define GETDNS_RRTYPE/ && !/^#define GETDNS_RRCLASS/ && !/^#define GETDNS_OPCODE/ && !/^#define GETDNS_RCODE/ && !/_TEXT/{ key = sprintf("%7d", $3); consts[key] = $2; }/^#define GETDNS_[A-Z_]+[ ]+\(\(getdns_(return|append_name)_t) [0-9]+ \)/{ key = sprintf("%7d", $4); consts[key] = $2; }END{ n = asorti(consts, const_vals); for ( i = 1; i <= n; i++) { val = const_vals[i]; name = consts[val]; print "\t{ "val", \""name"\", "name"_TEXT },"}}' getdns/getdns_extra.h.in getdns/getdns.h.in | sed 's/,,/,/g' >> const-info.c
|
||||
gawk '/^[ ]+GETDNS_[A-Z_]+[ ]+=[ ]+[0-9]+/{ key = sprintf("%7d", $3); consts[key] = $1; }/^#define GETDNS_[A-Z_]+[ ]+[0-9]+/ && !/^#define GETDNS_RRTYPE/ && !/^#define GETDNS_RRCLASS/ && !/^#define GETDNS_OPCODE/ && !/^#define GETDNS_RCODE/ && !/_TEXT/{ key = sprintf("%7d", $3); consts[key] = $2; }/^#define GETDNS_[A-Z_]+[ ]+\(\(getdns_(return|append_name)_t) [0-9]+ \)/{ key = sprintf("%7d", $4); consts[key] = $2; }END{ n = asorti(consts, const_vals); for ( i = 1; i <= n; i++) { val = const_vals[i]; name = consts[val]; print "\t{ "val", \""name"\", "name"_TEXT },"}}' getdns/getdns_extra.h.in getdns/getdns.h.in const-info.h| sed 's/,,/,/g' >> const-info.c
|
||||
cat >> const-info.c << END_OF_TAIL
|
||||
};
|
||||
|
||||
|
@ -49,7 +49,7 @@ getdns_get_errorstr_by_id(uint16_t err)
|
|||
|
||||
static struct const_name_info consts_name_info[] = {
|
||||
END_OF_TAIL
|
||||
gawk '/^[ ]+GETDNS_[A-Z_]+[ ]+=[ ]+[0-9]+/{ key = sprintf("%d", $3); consts[$1] = key; }/^#define GETDNS_[A-Z_]+[ ]+[0-9]+/ && !/_TEXT/{ key = sprintf("%d", $3); consts[$2] = key; }/^#define GETDNS_[A-Z_]+[ ]+\(\(getdns_(return|append_name)_t) [0-9]+ \)/{ key = sprintf("%d", $4); consts[$2] = key; }END{ n = asorti(consts, const_vals); for ( i = 1; i <= n; i++) { val = const_vals[i]; name = consts[val]; print "\t{ \""val"\", "name" },"}}' getdns/getdns.h.in getdns/getdns_extra.h.in | sed 's/,,/,/g' >> const-info.c
|
||||
gawk '/^[ ]+GETDNS_[A-Z_]+[ ]+=[ ]+[0-9]+/{ key = sprintf("%d", $3); consts[$1] = key; }/^#define GETDNS_[A-Z_]+[ ]+[0-9]+/ && !/_TEXT/{ key = sprintf("%d", $3); consts[$2] = key; }/^#define GETDNS_[A-Z_]+[ ]+\(\(getdns_(return|append_name)_t) [0-9]+ \)/{ key = sprintf("%d", $4); consts[$2] = key; }END{ n = asorti(consts, const_vals); for ( i = 1; i <= n; i++) { val = const_vals[i]; name = consts[val]; print "\t{ \""val"\", "name" },"}}' getdns/getdns.h.in getdns/getdns_extra.h.in const-info.h| sed 's/,,/,/g' >> const-info.c
|
||||
cat >> const-info.c << END_OF_TAIL
|
||||
};
|
||||
|
||||
|
|
13
src/stub.c
13
src/stub.c
|
@ -2186,17 +2186,18 @@ upstream_select(getdns_network_req *netreq)
|
|||
i = 0;
|
||||
} while (i != upstreams->current_udp);
|
||||
|
||||
/* Select upstream with the lowest back_off value */
|
||||
/* Select upstream with the lowest back_off value */
|
||||
upstream = upstreams->upstreams;
|
||||
for (i = 0; i < upstreams->count; i+=GETDNS_UPSTREAM_TRANSPORTS)
|
||||
if (upstreams->upstreams[i].back_off < upstream->back_off)
|
||||
upstream = &upstreams->upstreams[i];
|
||||
|
||||
/* Restrict back_off in case no upstream is available to achieve
|
||||
(more or less) round-robin retry on all upstreams. */
|
||||
if (upstream->back_off > 4)
|
||||
for (i = 0; i < upstreams->count; i+=GETDNS_UPSTREAM_TRANSPORTS)
|
||||
upstreams->upstreams[i].back_off = 2;
|
||||
/* Restrict back_off in case no upstream is available to achieve
|
||||
(more or less) round-robin retry on all upstreams. */
|
||||
if (upstream->back_off > 4) {
|
||||
for (i = 0; i < upstreams->count; i+=GETDNS_UPSTREAM_TRANSPORTS)
|
||||
upstreams->upstreams[i].back_off = 2;
|
||||
}
|
||||
upstream->to_retry = 1;
|
||||
upstreams->current_udp = upstream - upstreams->upstreams;
|
||||
return upstream;
|
||||
|
|
Loading…
Reference in New Issue