diff options
author | dvshkurko <dvshkurko@yandex-team.ru> | 2022-02-10 16:45:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:52 +0300 |
commit | c768a99151e47c3a4bb7b92c514d256abd301c4d (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/c-ares/ares_process.c | |
parent | 321ee9bce31ec6e238be26dbcbe539cffa2c3309 (diff) | |
download | ydb-c768a99151e47c3a4bb7b92c514d256abd301c4d.tar.gz |
Restoring authorship annotation for <dvshkurko@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/c-ares/ares_process.c')
-rw-r--r-- | contrib/libs/c-ares/ares_process.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/contrib/libs/c-ares/ares_process.c b/contrib/libs/c-ares/ares_process.c index 034cd2c4ae..25095d0f05 100644 --- a/contrib/libs/c-ares/ares_process.c +++ b/contrib/libs/c-ares/ares_process.c @@ -53,7 +53,7 @@ #include <assert.h> #include <fcntl.h> -#include <limits.h> +#include <limits.h> #include "ares.h" #include "ares_dns.h" @@ -872,32 +872,32 @@ void ares__send_query(ares_channel channel, struct query *query, return; } } - - /* For each trip through the entire server list, double the channel's - * assigned timeout, avoiding overflow. If channel->timeout is negative, - * leave it as-is, even though that should be impossible here. - */ - timeplus = channel->timeout; - { - /* How many times do we want to double it? Presume sane values here. */ - const int shift = query->try_count / channel->nservers; - - /* Is there enough room to shift timeplus left that many times? - * - * To find out, confirm that all of the bits we'll shift away are zero. - * Stop considering a shift if we get to the point where we could shift - * a 1 into the sign bit (i.e. when shift is within two of the bit - * count). - * - * This has the side benefit of leaving negative numbers unchanged. - */ - if(shift <= (int)(sizeof(int) * CHAR_BIT - 1) - && (timeplus >> (sizeof(int) * CHAR_BIT - 1 - shift)) == 0) - { - timeplus <<= shift; - } - } - + + /* For each trip through the entire server list, double the channel's + * assigned timeout, avoiding overflow. If channel->timeout is negative, + * leave it as-is, even though that should be impossible here. + */ + timeplus = channel->timeout; + { + /* How many times do we want to double it? Presume sane values here. */ + const int shift = query->try_count / channel->nservers; + + /* Is there enough room to shift timeplus left that many times? + * + * To find out, confirm that all of the bits we'll shift away are zero. + * Stop considering a shift if we get to the point where we could shift + * a 1 into the sign bit (i.e. when shift is within two of the bit + * count). + * + * This has the side benefit of leaving negative numbers unchanged. + */ + if(shift <= (int)(sizeof(int) * CHAR_BIT - 1) + && (timeplus >> (sizeof(int) * CHAR_BIT - 1 - shift)) == 0) + { + timeplus <<= shift; + } + } + if (channel->maxtimeout != -1 && timeplus > channel->maxtimeout) timeplus = channel->maxtimeout; |