use same time source for timeout initialization and processing

pull/1/head
Yang Tse 17 years ago
parent 6882b4020e
commit a43aec1b56
  1. 5
      ares_init.c

@ -108,6 +108,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
int i; int i;
int status = ARES_SUCCESS; int status = ARES_SUCCESS;
struct server_state *server; struct server_state *server;
struct timeval now;
#ifdef CURLDEBUG #ifdef CURLDEBUG
const char *env = getenv("CARES_MEMDEBUG"); const char *env = getenv("CARES_MEMDEBUG");
@ -125,6 +126,8 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
return ARES_ENOMEM; return ARES_ENOMEM;
} }
now = ares__tvnow();
/* Set everything to distinguished values so we know they haven't /* Set everything to distinguished values so we know they haven't
* been set yet. * been set yet.
*/ */
@ -147,7 +150,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
channel->sock_state_cb = NULL; channel->sock_state_cb = NULL;
channel->sock_state_cb_data = NULL; channel->sock_state_cb_data = NULL;
channel->last_timeout_processed = (long)time(NULL); channel->last_timeout_processed = (time_t)now.tv_sec;
/* Initialize our lists of queries */ /* Initialize our lists of queries */
ares__init_list_head(&(channel->all_queries)); ares__init_list_head(&(channel->all_queries));

Loading…
Cancel
Save