Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 0 additions & 73 deletions iocore/hostdb/HostDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -949,79 +949,6 @@ HostDBContinuation::setbyEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS
return EVENT_DONE;
}

static bool
remove_round_robin(HostDBInfo *r, const char *hostname, IpAddr const &ip)
{
if (r) {
if (!r->round_robin) {
return false;
}
HostDBRoundRobin *rr = r->rr();
if (!rr) {
return false;
}
for (int i = 0; i < rr->good; i++) {
if (ip == rr->info(i).ip()) {
ip_text_buffer b;
Debug("hostdb", "Deleting %s from '%s' round robin DNS entry", ip.toString(b, sizeof b), hostname);
HostDBInfo tmp = rr->info(i);
rr->info(i) = rr->info(rr->good - 1);
rr->info(rr->good - 1) = tmp;
rr->good--;
if (rr->good <= 0) {
hostDB.refcountcache->erase(r->key);
return false;
} else {
if (is_debug_tag_set("hostdb")) {
int bufsize = rr->good * INET6_ADDRSTRLEN;
char *rr_ip_list = static_cast<char *>(alloca(bufsize));
char *p = rr_ip_list;
for (int n = 0; n < rr->good; ++n) {
ats_ip_ntop(rr->info(n).ip(), p, bufsize);
int nbytes = strlen(p);
p += nbytes;
bufsize -= nbytes;
}
Note("'%s' round robin DNS entry updated, entries=%d, IP list: %s", hostname, rr->good, rr_ip_list);
}
}
return true;
}
}
}
return false;
}

int
HostDBContinuation::removeEvent(int /* event ATS_UNUSED */, Event *e)
{
Continuation *cont = action.continuation;
Ptr<ProxyMutex> proxy_mutex;
if (cont) {
proxy_mutex = cont->mutex;
}
WEAK_MUTEX_TRY_LOCK(lock, proxy_mutex, e->ethread);
if (!lock.is_locked()) {
e->schedule_in(HOST_DB_RETRY_PERIOD);
return EVENT_CONT;
}
if (!action.cancelled) {
if (!hostdb_enable) {
if (cont) {
cont->handleEvent(EVENT_HOST_DB_IP_REMOVED, (void *)nullptr);
}
} else {
Ptr<HostDBInfo> r = probe(mutex, hash, false);
bool res = remove_round_robin(r.get(), hash.host_name, hash.ip);
if (cont) {
cont->handleEvent(EVENT_HOST_DB_IP_REMOVED, res ? static_cast<void *>(&hash.ip) : static_cast<void *>(nullptr));
}
}
}
hostdb_cont_free(this);
return EVENT_DONE;
}

// Lookup done, insert into the local table, return data to the
// calling continuation.
// NOTE: if "i" exists it means we already allocated the space etc, just return
Expand Down
1 change: 0 additions & 1 deletion iocore/hostdb/P_HostDBProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ struct HostDBContinuation : public Continuation {
int dnsPendingEvent(int event, Event *e);
int backgroundEvent(int event, Event *e);
int retryEvent(int event, Event *e);
int removeEvent(int event, Event *e);
int setbyEvent(int event, Event *e);

/// Recompute the hash and update ancillary values.
Expand Down