From 1fa4aa7047cb6855eaab5376e88c6d392864b833 Mon Sep 17 00:00:00 2001 From: "Alan M. Carroll" Date: Fri, 11 Dec 2020 14:10:44 -0600 Subject: [PATCH] Unused code: HostDBContinuation::removeEvent --- iocore/hostdb/HostDB.cc | 73 ------------------------------- iocore/hostdb/P_HostDBProcessor.h | 1 - 2 files changed, 74 deletions(-) diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index 9ca0f4e4350..6589b211872 100644 --- a/iocore/hostdb/HostDB.cc +++ b/iocore/hostdb/HostDB.cc @@ -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(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 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 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(&hash.ip) : static_cast(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 diff --git a/iocore/hostdb/P_HostDBProcessor.h b/iocore/hostdb/P_HostDBProcessor.h index a6a3998e150..1dbe1a5799b 100644 --- a/iocore/hostdb/P_HostDBProcessor.h +++ b/iocore/hostdb/P_HostDBProcessor.h @@ -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.