mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 13:04:23 -04:00
Merge pull request #212 from xbao/master
changed strtotimeval signature to avoid conflict with Android NDK sys/time.h header (#211)
This commit is contained in:
commit
4472ec68e6
8
evdns.c
8
evdns.c
@ -3352,7 +3352,7 @@ strtoint(const char *const str)
|
|||||||
|
|
||||||
/* Parse a number of seconds into a timeval; return -1 on error. */
|
/* Parse a number of seconds into a timeval; return -1 on error. */
|
||||||
static int
|
static int
|
||||||
strtotimeval(const char *const str, struct timeval *out)
|
evdns_strtotimeval(const char *const str, struct timeval *out)
|
||||||
{
|
{
|
||||||
double d;
|
double d;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
@ -3455,13 +3455,13 @@ evdns_base_set_option_impl(struct evdns_base *base,
|
|||||||
base->global_search_state->ndots = ndots;
|
base->global_search_state->ndots = ndots;
|
||||||
} else if (str_matches_option(option, "timeout:")) {
|
} else if (str_matches_option(option, "timeout:")) {
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
if (strtotimeval(val, &tv) == -1) return -1;
|
if (evdns_strtotimeval(val, &tv) == -1) return -1;
|
||||||
if (!(flags & DNS_OPTION_MISC)) return 0;
|
if (!(flags & DNS_OPTION_MISC)) return 0;
|
||||||
log(EVDNS_LOG_DEBUG, "Setting timeout to %s", val);
|
log(EVDNS_LOG_DEBUG, "Setting timeout to %s", val);
|
||||||
memcpy(&base->global_timeout, &tv, sizeof(struct timeval));
|
memcpy(&base->global_timeout, &tv, sizeof(struct timeval));
|
||||||
} else if (str_matches_option(option, "getaddrinfo-allow-skew:")) {
|
} else if (str_matches_option(option, "getaddrinfo-allow-skew:")) {
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
if (strtotimeval(val, &tv) == -1) return -1;
|
if (evdns_strtotimeval(val, &tv) == -1) return -1;
|
||||||
if (!(flags & DNS_OPTION_MISC)) return 0;
|
if (!(flags & DNS_OPTION_MISC)) return 0;
|
||||||
log(EVDNS_LOG_DEBUG, "Setting getaddrinfo-allow-skew to %s",
|
log(EVDNS_LOG_DEBUG, "Setting getaddrinfo-allow-skew to %s",
|
||||||
val);
|
val);
|
||||||
@ -3503,7 +3503,7 @@ evdns_base_set_option_impl(struct evdns_base *base,
|
|||||||
base->global_outgoing_addrlen = len;
|
base->global_outgoing_addrlen = len;
|
||||||
} else if (str_matches_option(option, "initial-probe-timeout:")) {
|
} else if (str_matches_option(option, "initial-probe-timeout:")) {
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
if (strtotimeval(val, &tv) == -1) return -1;
|
if (evdns_strtotimeval(val, &tv) == -1) return -1;
|
||||||
if (tv.tv_sec > 3600)
|
if (tv.tv_sec > 3600)
|
||||||
tv.tv_sec = 3600;
|
tv.tv_sec = 3600;
|
||||||
if (!(flags & DNS_OPTION_MISC)) return 0;
|
if (!(flags & DNS_OPTION_MISC)) return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user