summaryrefslogtreecommitdiff
path: root/ares_timeout.c
diff options
context:
space:
mode:
authorYu Jiung <jiung.yu@samsung.com>2016-11-10 16:59:08 +0900
committerYu Jiung <jiung.yu@samsung.com>2016-11-10 16:59:08 +0900
commit6e8e7a899a742f7f170ff6f07a26cf4832f4fdc9 (patch)
tree81f0750d91aa467df3ee81cf30d22a65db2e6685 /ares_timeout.c
parentd82f8426a5e255f0533f07ee458870ba124f90e7 (diff)
parent45e88a8337839e5fd88519bc55467053d521c9f6 (diff)
downloadc-ares-accepted/tizen/3.0/base/20161118.080913.tar.gz
c-ares-accepted/tizen/3.0/base/20161118.080913.tar.bz2
c-ares-accepted/tizen/3.0/base/20161118.080913.zip
Conflicts: packaging/c-ares.spec Change-Id: Id23d5351f77b4520d8bbcc4c0e1eb09136018b58
Diffstat (limited to 'ares_timeout.c')
-rw-r--r--ares_timeout.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ares_timeout.c b/ares_timeout.c
index 0b5a435..293e4af 100644
--- a/ares_timeout.c
+++ b/ares_timeout.c
@@ -23,6 +23,13 @@
#include "ares.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
* requests! You are probably far better off just calling ares_process()
* 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;
if (query->timeout.tv_sec == 0)
continue;
- offset = ares__timeoffset(&now, &query->timeout);
+ offset = timeoffset(&now, &query->timeout);
if (offset < 0)
offset = 0;
if (min_offset == -1 || offset < min_offset)