You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2017/11/08 17:40:46 UTC

[trafficserver] branch 7.1.x updated: Optimze: Use a positive number as the timeout of DNSEntry.

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/7.1.x by this push:
     new 65e5446  Optimze: Use a positive number as the timeout of DNSEntry.
65e5446 is described below

commit 65e544688b8b0e677ce1606948cc247a224e3a05
Author: Oknet Xu <xu...@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.
    
    (cherry picked from commit 40a948a37fb941d87c9fc263ecf98266f2a09f58)
    
     Conflicts:
    	iocore/dns/DNS.cc
---
 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 b77b190..0c0c4ae 100644
--- a/iocore/dns/DNS.cc
+++ b/iocore/dns/DNS.cc
@@ -509,7 +509,7 @@ DNSHandler::startEvent(int /* event ATS_UNUSED */, Event *e)
       open_con(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 {
@@ -532,7 +532,7 @@ DNSHandler::startEvent_sdns(int /* event ATS_UNUSED */, Event *e)
   open_con(&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;
 }
 
@@ -1237,7 +1237,7 @@ Lretry:
   e->retries    = 0;
   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 8fead49..be22b01 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" <co...@trafficserver.apache.org>'].