diff options
author | max42 <max42@yandex-team.ru> | 2022-02-10 16:47:51 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:51 +0300 |
commit | 9988f7c537b40605e1a0aaae2977d5f540425b83 (patch) | |
tree | a4f3497f66e2dcd82d0f7ae7573acd1320d1bc78 /contrib/libs/c-ares/ares_process.c | |
parent | 0a579de32b745908473b2cea7c5cd5540bc801f0 (diff) | |
download | ydb-9988f7c537b40605e1a0aaae2977d5f540425b83.tar.gz |
Restoring authorship annotation for <max42@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/c-ares/ares_process.c')
-rw-r--r-- | contrib/libs/c-ares/ares_process.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/contrib/libs/c-ares/ares_process.c b/contrib/libs/c-ares/ares_process.c index 25095d0f05..403ba57ffc 100644 --- a/contrib/libs/c-ares/ares_process.c +++ b/contrib/libs/c-ares/ares_process.c @@ -898,27 +898,27 @@ void ares__send_query(ares_channel channel, struct query *query, } } - if (channel->maxtimeout != -1 && timeplus > channel->maxtimeout) - timeplus = channel->maxtimeout; - - if (channel->jitter != -1) - { - int r; - #ifdef WIN32 - /* Windows does not have rand_r function, so we use regular rand(). - * It is thread-unsafe, but it is better than nothing. - */ - r = rand(); - #else - r = rand_r(&channel->jitter_rand_state); - #endif - long long delta = (long long)(r - (RAND_MAX >> 1)) * timeplus * channel->jitter; - delta /= RAND_MAX; - /* Recall that jitter is expressed in .001 */ - delta /= 1000; - timeplus += delta; - } - + if (channel->maxtimeout != -1 && timeplus > channel->maxtimeout) + timeplus = channel->maxtimeout; + + if (channel->jitter != -1) + { + int r; + #ifdef WIN32 + /* Windows does not have rand_r function, so we use regular rand(). + * It is thread-unsafe, but it is better than nothing. + */ + r = rand(); + #else + r = rand_r(&channel->jitter_rand_state); + #endif + long long delta = (long long)(r - (RAND_MAX >> 1)) * timeplus * channel->jitter; + delta /= RAND_MAX; + /* Recall that jitter is expressed in .001 */ + delta /= 1000; + timeplus += delta; + } + query->timeout = *now; timeadd(&query->timeout, timeplus); /* Keep track of queries bucketed by timeout, so we can process |