Skip to content

Commit 107d886

Browse files
committed
don't need negative events now
1 parent 2724159 commit 107d886

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

iocore/dns/DNS.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ DNSHandler::startEvent(int /* event ATS_UNUSED */, Event *e)
567567
open_cons(nullptr); // use current target address.
568568
n_con = 1;
569569
}
570-
e->ethread->schedule_every(this, -DNS_PERIOD);
571570

572571
return EVENT_CONT;
573572
} else {
@@ -590,7 +589,6 @@ DNSHandler::startEvent_sdns(int /* event ATS_UNUSED */, Event *e)
590589
open_cons(&ip.sa, false, n_con);
591590
++n_con; // TODO should n_con be zeroed?
592591

593-
e->schedule_every(-DNS_PERIOD);
594592
return EVENT_CONT;
595593
}
596594

@@ -958,6 +956,10 @@ DNSHandler::mainEvent(int event, Event *e)
958956
write_dns(this);
959957
}
960958

959+
if (std::any_of(ns_down, ns_down + n_con, [](int f) { return f != 0; })) {
960+
this_ethread()->schedule_at(this, DNS_PRIMARY_RETRY_PERIOD);
961+
}
962+
961963
return EVENT_CONT;
962964
}
963965

iocore/dns/DNSConnection.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ void
7878
DNSConnection::trigger()
7979
{
8080
handler->triggered.enqueue(this);
81+
82+
// Since the periodic check is removed, we need to call
83+
// this when it's triggered by EVENTIO_DNS_CONNECTION.
84+
// The handler should be pionting to DNSHandler::mainEvent.
85+
// We can schedule an immediate event or call the handler
86+
// directly, and since both arguments are not being used
87+
// passing in 0 and nullptr will do the job.
88+
handler->handleEvent(0, nullptr);
8189
}
8290

8391
int

0 commit comments

Comments
 (0)