Loading ares/CHANGES +5 −0 Original line number Diff line number Diff line Changelog for the c-ares project * May 13 2008 (Daniel Stenberg) - Introducing millisecond resolution support for the timeout option. See ares_init_options()'s ARES_OPT_TIMEOUTMS. * May 9 2008 (Yang Tse) - Use monotonic time source if available, for private function ares__tvnow() Loading ares/ares.h +3 −1 Original line number Diff line number Diff line /* $Id$ */ /* Copyright 1998 by the Massachusetts Institute of Technology. * Copyright (C) 2007 by Daniel Stenberg * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without Loading Loading @@ -112,6 +113,7 @@ extern "C" { #define ARES_OPT_SORTLIST (1 << 10) #define ARES_OPT_SOCK_SNDBUF (1 << 11) #define ARES_OPT_SOCK_RCVBUF (1 << 12) #define ARES_OPT_TIMEOUTMS (1 << 13) /* Nameinfo flag values */ #define ARES_NI_NOFQDN (1 << 0) Loading Loading @@ -179,7 +181,7 @@ struct apattern; struct ares_options { int flags; int timeout; int timeout; /* in seconds or milliseconds, depending on options */ int tries; int ndots; unsigned short udp_port; Loading ares/ares_init.3 +18 −5 Original line number Diff line number Diff line .\" $Id$ .\" .\" Copyright 1998 by the Massachusetts Institute of Technology. .\" Copyright (C) 2007-2008 by Daniel Stenberg .\" .\" Permission to use, copy, modify, and distribute this .\" software and its documentation for any purpose and without Loading @@ -14,7 +15,7 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" .TH ARES_INIT 3 "7 December 2004" .TH ARES_INIT 3 "13 May 2008" .SH NAME ares_init, ares_init_options \- Initialize a resolver channel .SH SYNOPSIS Loading Loading @@ -49,10 +50,22 @@ description of possible flag values. .B ARES_OPT_TIMEOUT .B int \fItimeout\fP; .br The number of seconds each name server is given to respond to a query on the first try. (After the first try, the timeout algorithm becomes more complicated, but scales linearly with the value of \fItimeout\fP.) The default is five seconds. The number of seconds each name server is given to respond to a query on the first try. (After the first try, the timeout algorithm becomes more complicated, but scales linearly with the value of \fItimeout\fP.) The default is five seconds. This option is being deprecated by \fIARES_OPT_TIMEOUTMS\fP starting in c-ares 1.5.2. .TP 18 .B ARES_OPT_TIMEOUTMS .B int \fItimeout\fP; .br The number of milliseconds each name server is given to respond to a query on the first try. (After the first try, the timeout algorithm becomes more complicated, but scales linearly with the value of \fItimeout\fP.) The default is five seconds. Note that this option is specified with the same struct field as the former \fIARES_OPT_TIMEOUT\fP, it is but the option bits that tell c-ares how to interpret the number. This option was added in c-ares 1.5.2. .TP 18 .B ARES_OPT_TRIES .B int \fItries\fP; Loading ares/ares_init.c +9 −3 Original line number Diff line number Diff line /* $Id$ */ /* Copyright 1998 by the Massachusetts Institute of Technology. * Copyright (C) 2007-2008 by Daniel Stenberg * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without Loading Loading @@ -254,13 +255,16 @@ int ares_save_options(ares_channel channel, struct ares_options *options, if (!ARES_CONFIG_CHECK(channel)) return ARES_ENODATA; (*optmask) = (ARES_OPT_FLAGS|ARES_OPT_TIMEOUT|ARES_OPT_TRIES|ARES_OPT_NDOTS| (*optmask) = (ARES_OPT_FLAGS|ARES_OPT_TRIES|ARES_OPT_NDOTS| ARES_OPT_UDP_PORT|ARES_OPT_TCP_PORT|ARES_OPT_SOCK_STATE_CB| ARES_OPT_SERVERS|ARES_OPT_DOMAINS|ARES_OPT_LOOKUPS| ARES_OPT_SORTLIST); ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS); /* Copy easy stuff */ options->flags = channel->flags; /* We return full millisecond resolution but that's only because we don't set the ARES_OPT_TIMEOUT anymore, only the new ARES_OPT_TIMEOUTMS */ options->timeout = channel->timeout; options->tries = channel->tries; options->ndots = channel->ndots; Loading Loading @@ -328,8 +332,10 @@ static int init_by_options(ares_channel channel, /* Easy stuff. */ if ((optmask & ARES_OPT_FLAGS) && channel->flags == -1) channel->flags = options->flags; if ((optmask & ARES_OPT_TIMEOUT) && channel->timeout == -1) if ((optmask & ARES_OPT_TIMEOUTMS) && channel->timeout == -1) channel->timeout = options->timeout; else if ((optmask & ARES_OPT_TIMEOUT) && channel->timeout == -1) channel->timeout = options->timeout * 1000; if ((optmask & ARES_OPT_TRIES) && channel->tries == -1) channel->tries = options->tries; if ((optmask & ARES_OPT_NDOTS) && channel->ndots == -1) Loading ares/ares_private.h +17 −5 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ /* $Id$ */ /* Copyright 1998 by the Massachusetts Institute of Technology. * Copyright (C) 2004-2008 by Daniel Stenberg * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without Loading Loading @@ -48,7 +49,7 @@ #include <time.h> #endif #define DEFAULT_TIMEOUT 5 #define DEFAULT_TIMEOUT 5000 /* milliseconds */ #define DEFAULT_TRIES 4 #ifndef INADDR_NONE #define INADDR_NONE 0xffffffff Loading Loading @@ -149,7 +150,7 @@ struct server_state { struct query { /* Query ID from qbuf, for faster lookup, and current timeout */ unsigned short qid; time_t timeout; struct timeval timeout; /* * Links for the doubly-linked lists in which we insert a query. Loading Loading @@ -217,7 +218,7 @@ typedef struct rc4_key struct ares_channeldata { /* Configuration data */ int flags; int timeout; int timeout; /* in milliseconds */ int tries; int ndots; int udp_port; Loading @@ -242,7 +243,8 @@ struct ares_channeldata { /* Generation number to use for the next TCP socket open/close */ int tcp_connection_generation; /* The time at which we last called process_timeouts() */ /* The time at which we last called process_timeouts(). Uses integer seconds just to draw the line somewhere. */ time_t last_timeout_processed; /* Circular, doubly-linked list of queries, bucketed various ways.... */ Loading @@ -259,8 +261,18 @@ struct ares_channeldata { void *sock_state_cb_data; }; /* return true if now is exactly check time or later */ int ares__timedout(struct timeval *now, struct timeval *check); /* add the specific number of milliseconds to the time in the first argument */ int ares__timeadd(struct timeval *now, int millisecs); /* return time offset between now and (future) check, in milliseconds */ int ares__timeoffset(struct timeval *now, struct timeval *check); void ares__rc4(rc4_key* key,unsigned char *buffer_ptr, int buffer_len); void ares__send_query(ares_channel channel, struct query *query, time_t now); void ares__send_query(ares_channel channel, struct query *query, struct timeval *now); 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); Loading Loading
ares/CHANGES +5 −0 Original line number Diff line number Diff line Changelog for the c-ares project * May 13 2008 (Daniel Stenberg) - Introducing millisecond resolution support for the timeout option. See ares_init_options()'s ARES_OPT_TIMEOUTMS. * May 9 2008 (Yang Tse) - Use monotonic time source if available, for private function ares__tvnow() Loading
ares/ares.h +3 −1 Original line number Diff line number Diff line /* $Id$ */ /* Copyright 1998 by the Massachusetts Institute of Technology. * Copyright (C) 2007 by Daniel Stenberg * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without Loading Loading @@ -112,6 +113,7 @@ extern "C" { #define ARES_OPT_SORTLIST (1 << 10) #define ARES_OPT_SOCK_SNDBUF (1 << 11) #define ARES_OPT_SOCK_RCVBUF (1 << 12) #define ARES_OPT_TIMEOUTMS (1 << 13) /* Nameinfo flag values */ #define ARES_NI_NOFQDN (1 << 0) Loading Loading @@ -179,7 +181,7 @@ struct apattern; struct ares_options { int flags; int timeout; int timeout; /* in seconds or milliseconds, depending on options */ int tries; int ndots; unsigned short udp_port; Loading
ares/ares_init.3 +18 −5 Original line number Diff line number Diff line .\" $Id$ .\" .\" Copyright 1998 by the Massachusetts Institute of Technology. .\" Copyright (C) 2007-2008 by Daniel Stenberg .\" .\" Permission to use, copy, modify, and distribute this .\" software and its documentation for any purpose and without Loading @@ -14,7 +15,7 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" .TH ARES_INIT 3 "7 December 2004" .TH ARES_INIT 3 "13 May 2008" .SH NAME ares_init, ares_init_options \- Initialize a resolver channel .SH SYNOPSIS Loading Loading @@ -49,10 +50,22 @@ description of possible flag values. .B ARES_OPT_TIMEOUT .B int \fItimeout\fP; .br The number of seconds each name server is given to respond to a query on the first try. (After the first try, the timeout algorithm becomes more complicated, but scales linearly with the value of \fItimeout\fP.) The default is five seconds. The number of seconds each name server is given to respond to a query on the first try. (After the first try, the timeout algorithm becomes more complicated, but scales linearly with the value of \fItimeout\fP.) The default is five seconds. This option is being deprecated by \fIARES_OPT_TIMEOUTMS\fP starting in c-ares 1.5.2. .TP 18 .B ARES_OPT_TIMEOUTMS .B int \fItimeout\fP; .br The number of milliseconds each name server is given to respond to a query on the first try. (After the first try, the timeout algorithm becomes more complicated, but scales linearly with the value of \fItimeout\fP.) The default is five seconds. Note that this option is specified with the same struct field as the former \fIARES_OPT_TIMEOUT\fP, it is but the option bits that tell c-ares how to interpret the number. This option was added in c-ares 1.5.2. .TP 18 .B ARES_OPT_TRIES .B int \fItries\fP; Loading
ares/ares_init.c +9 −3 Original line number Diff line number Diff line /* $Id$ */ /* Copyright 1998 by the Massachusetts Institute of Technology. * Copyright (C) 2007-2008 by Daniel Stenberg * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without Loading Loading @@ -254,13 +255,16 @@ int ares_save_options(ares_channel channel, struct ares_options *options, if (!ARES_CONFIG_CHECK(channel)) return ARES_ENODATA; (*optmask) = (ARES_OPT_FLAGS|ARES_OPT_TIMEOUT|ARES_OPT_TRIES|ARES_OPT_NDOTS| (*optmask) = (ARES_OPT_FLAGS|ARES_OPT_TRIES|ARES_OPT_NDOTS| ARES_OPT_UDP_PORT|ARES_OPT_TCP_PORT|ARES_OPT_SOCK_STATE_CB| ARES_OPT_SERVERS|ARES_OPT_DOMAINS|ARES_OPT_LOOKUPS| ARES_OPT_SORTLIST); ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS); /* Copy easy stuff */ options->flags = channel->flags; /* We return full millisecond resolution but that's only because we don't set the ARES_OPT_TIMEOUT anymore, only the new ARES_OPT_TIMEOUTMS */ options->timeout = channel->timeout; options->tries = channel->tries; options->ndots = channel->ndots; Loading Loading @@ -328,8 +332,10 @@ static int init_by_options(ares_channel channel, /* Easy stuff. */ if ((optmask & ARES_OPT_FLAGS) && channel->flags == -1) channel->flags = options->flags; if ((optmask & ARES_OPT_TIMEOUT) && channel->timeout == -1) if ((optmask & ARES_OPT_TIMEOUTMS) && channel->timeout == -1) channel->timeout = options->timeout; else if ((optmask & ARES_OPT_TIMEOUT) && channel->timeout == -1) channel->timeout = options->timeout * 1000; if ((optmask & ARES_OPT_TRIES) && channel->tries == -1) channel->tries = options->tries; if ((optmask & ARES_OPT_NDOTS) && channel->ndots == -1) Loading
ares/ares_private.h +17 −5 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ /* $Id$ */ /* Copyright 1998 by the Massachusetts Institute of Technology. * Copyright (C) 2004-2008 by Daniel Stenberg * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without Loading Loading @@ -48,7 +49,7 @@ #include <time.h> #endif #define DEFAULT_TIMEOUT 5 #define DEFAULT_TIMEOUT 5000 /* milliseconds */ #define DEFAULT_TRIES 4 #ifndef INADDR_NONE #define INADDR_NONE 0xffffffff Loading Loading @@ -149,7 +150,7 @@ struct server_state { struct query { /* Query ID from qbuf, for faster lookup, and current timeout */ unsigned short qid; time_t timeout; struct timeval timeout; /* * Links for the doubly-linked lists in which we insert a query. Loading Loading @@ -217,7 +218,7 @@ typedef struct rc4_key struct ares_channeldata { /* Configuration data */ int flags; int timeout; int timeout; /* in milliseconds */ int tries; int ndots; int udp_port; Loading @@ -242,7 +243,8 @@ struct ares_channeldata { /* Generation number to use for the next TCP socket open/close */ int tcp_connection_generation; /* The time at which we last called process_timeouts() */ /* The time at which we last called process_timeouts(). Uses integer seconds just to draw the line somewhere. */ time_t last_timeout_processed; /* Circular, doubly-linked list of queries, bucketed various ways.... */ Loading @@ -259,8 +261,18 @@ struct ares_channeldata { void *sock_state_cb_data; }; /* return true if now is exactly check time or later */ int ares__timedout(struct timeval *now, struct timeval *check); /* add the specific number of milliseconds to the time in the first argument */ int ares__timeadd(struct timeval *now, int millisecs); /* return time offset between now and (future) check, in milliseconds */ int ares__timeoffset(struct timeval *now, struct timeval *check); void ares__rc4(rc4_key* key,unsigned char *buffer_ptr, int buffer_len); void ares__send_query(ares_channel channel, struct query *query, time_t now); void ares__send_query(ares_channel channel, struct query *query, struct timeval *now); 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); Loading