timeoffset: made static and private
ares__timeoffset() was only used once within this single source file
This commit is contained in:
parent
30c9031afa
commit
efdd616118
|
@ -311,9 +311,6 @@ struct ares_channeldata {
|
||||||
int ares__timedout(struct timeval *now,
|
int ares__timedout(struct timeval *now,
|
||||||
struct timeval *check);
|
struct timeval *check);
|
||||||
|
|
||||||
/* return time offset between now and (future) check, in milliseconds */
|
|
||||||
long ares__timeoffset(struct timeval *now,
|
|
||||||
struct timeval *check);
|
|
||||||
/* returns ARES_SUCCESS if library has been initialized */
|
/* returns ARES_SUCCESS if library has been initialized */
|
||||||
int ares_library_initialized(void);
|
int ares_library_initialized(void);
|
||||||
void ares__send_query(ares_channel channel, struct query *query,
|
void ares__send_query(ares_channel channel, struct query *query,
|
||||||
|
|
|
@ -115,15 +115,6 @@ static timeadd(struct timeval *now, int millisecs)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return time offset between now and (future) check, in milliseconds */
|
|
||||||
long ares__timeoffset(struct timeval *now,
|
|
||||||
struct timeval *check)
|
|
||||||
{
|
|
||||||
return (check->tv_sec - now->tv_sec)*1000 +
|
|
||||||
(check->tv_usec - now->tv_usec)/1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* generic process function
|
* generic process function
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,6 +23,13 @@
|
||||||
#include "ares.h"
|
#include "ares.h"
|
||||||
#include "ares_private.h"
|
#include "ares_private.h"
|
||||||
|
|
||||||
|
/* return time offset between now and (future) check, in milliseconds */
|
||||||
|
static long timeoffset(struct timeval *now, struct timeval *check)
|
||||||
|
{
|
||||||
|
return (check->tv_sec - now->tv_sec)*1000 +
|
||||||
|
(check->tv_usec - now->tv_usec)/1000;
|
||||||
|
}
|
||||||
|
|
||||||
/* WARNING: Beware that this is linear in the number of outstanding
|
/* WARNING: Beware that this is linear in the number of outstanding
|
||||||
* requests! You are probably far better off just calling ares_process()
|
* requests! You are probably far better off just calling ares_process()
|
||||||
* once per second, rather than calling ares_timeout() to figure out
|
* once per second, rather than calling ares_timeout() to figure out
|
||||||
|
@ -53,7 +60,7 @@ struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
|
||||||
query = list_node->data;
|
query = list_node->data;
|
||||||
if (query->timeout.tv_sec == 0)
|
if (query->timeout.tv_sec == 0)
|
||||||
continue;
|
continue;
|
||||||
offset = ares__timeoffset(&now, &query->timeout);
|
offset = timeoffset(&now, &query->timeout);
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
offset = 0;
|
offset = 0;
|
||||||
if (min_offset == -1 || offset < min_offset)
|
if (min_offset == -1 || offset < min_offset)
|
||||||
|
|
Loading…
Reference in New Issue