This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 40a948a Optimze: Use a positive number as the timeout of DNSEntry. 40a948a is described below commit 40a948a37fb941d87c9fc263ecf98266f2a09f58 Author: Oknet Xu <xuc...@skyguard.com.cn> AuthorDate: Wed Sep 27 16:53:59 2017 +0800 Optimze: Use a positive number as the timeout of DNSEntry. `schedule_every` with a negative is more readable. so I change the DNS_PERIOD to a postive value and call `schedule_every` with `-DNS_PERIOD`. It is a common design to reschedule the DNSEntry within `MUTEX_RETRY_DELAY` cause fail on mutex lock. --- iocore/dns/DNS.cc | 6 +++--- iocore/dns/P_DNSProcessor.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc index 823990d..f7e57ff 100644 --- a/iocore/dns/DNS.cc +++ b/iocore/dns/DNS.cc @@ -567,7 +567,7 @@ DNSHandler::startEvent(int /* event ATS_UNUSED */, Event *e) open_cons(nullptr); // use current target address. n_con = 1; } - e->ethread->schedule_every(this, DNS_PERIOD); + e->ethread->schedule_every(this, -DNS_PERIOD); return EVENT_CONT; } else { @@ -590,7 +590,7 @@ DNSHandler::startEvent_sdns(int /* event ATS_UNUSED */, Event *e) open_cons(&ip.sa, false, n_con); ++n_con; // TODO should n_con be zeroed? - e->schedule_every(DNS_PERIOD); + e->schedule_every(-DNS_PERIOD); return EVENT_CONT; } @@ -1368,7 +1368,7 @@ Lretry: if (e->timeout) { e->timeout->cancel(); } - e->timeout = h->mutex->thread_holding->schedule_in(e, DNS_PERIOD); + e->timeout = h->mutex->thread_holding->schedule_in(e, MUTEX_RETRY_DELAY); } int diff --git a/iocore/dns/P_DNSProcessor.h b/iocore/dns/P_DNSProcessor.h index 304322e..f4b6795 100644 --- a/iocore/dns/P_DNSProcessor.h +++ b/iocore/dns/P_DNSProcessor.h @@ -62,7 +62,7 @@ extern unsigned int dns_sequence_number; // Constants // -#define DNS_PERIOD HRTIME_MSECONDS(-100) +#define DNS_PERIOD HRTIME_MSECONDS(100) #define DNS_DELAY_PERIOD HRTIME_MSECONDS(10) #define DNS_SEQUENCE_NUMBER_RESTART_OFFSET 4000 #define DNS_PRIMARY_RETRY_PERIOD HRTIME_SECONDS(5) -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].