You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by du...@apache.org on 2018/04/27 14:51:27 UTC

[trafficserver] branch master updated: don't need negative events now

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

duke8253 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 107d886  don't need negative events now
107d886 is described below

commit 107d886d01fdcea33391cf907b2abfc589058a64
Author: Fei Deng <du...@gmail.com>
AuthorDate: Tue Apr 17 15:04:32 2018 -0500

    don't need negative events now
---
 iocore/dns/DNS.cc           | 6 ++++--
 iocore/dns/DNSConnection.cc | 8 ++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc
index e72f9d1..fc38127 100644
--- a/iocore/dns/DNS.cc
+++ b/iocore/dns/DNS.cc
@@ -567,7 +567,6 @@ 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);
 
     return EVENT_CONT;
   } else {
@@ -590,7 +589,6 @@ 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);
   return EVENT_CONT;
 }
 
@@ -958,6 +956,10 @@ DNSHandler::mainEvent(int event, Event *e)
     write_dns(this);
   }
 
+  if (std::any_of(ns_down, ns_down + n_con, [](int f) { return f != 0; })) {
+    this_ethread()->schedule_at(this, DNS_PRIMARY_RETRY_PERIOD);
+  }
+
   return EVENT_CONT;
 }
 
diff --git a/iocore/dns/DNSConnection.cc b/iocore/dns/DNSConnection.cc
index 7a289d6..311ff93 100644
--- a/iocore/dns/DNSConnection.cc
+++ b/iocore/dns/DNSConnection.cc
@@ -78,6 +78,14 @@ void
 DNSConnection::trigger()
 {
   handler->triggered.enqueue(this);
+
+  // Since the periodic check is removed, we need to call
+  // this when it's triggered by EVENTIO_DNS_CONNECTION.
+  // The handler should be pionting to DNSHandler::mainEvent.
+  // We can schedule an immediate event or call the handler
+  // directly, and since both arguments are not being used
+  // passing in 0 and nullptr will do the job.
+  handler->handleEvent(0, nullptr);
 }
 
 int

-- 
To stop receiving notification emails like this one, please contact
duke8253@apache.org.