@@ -100,21 +100,6 @@ HOSTDB_CLIENT_IP_HASH(sockaddr const *lhs, IpAddr const &rhs)
100100
101101} // namespace
102102
103- char const *
104- name_of (HostDBType t)
105- {
106- switch (t) {
107- case HostDBType::UNSPEC:
108- return " *" ;
109- case HostDBType::ADDR:
110- return " Address" ;
111- case HostDBType::SRV:
112- return " SRV" ;
113- case HostDBType::HOST:
114- return " Reverse DNS" ;
115- }
116- return " " ;
117- }
118103// Static configuration information
119104
120105HostDBCache hostDB;
@@ -160,13 +145,6 @@ check_for_retry(HostDBMark &mark, HostResStyle style)
160145 return zret;
161146}
162147
163- const char *
164- string_for (HostDBMark mark)
165- {
166- static const char *STRING[] = {" Generic" , " IPv4" , " IPv6" , " SRV" };
167- return STRING[mark];
168- }
169-
170148//
171149// Function Prototypes
172150//
@@ -275,21 +253,6 @@ HostDBProcessor::cache()
275253 return &hostDB;
276254}
277255
278- struct HostDBBackgroundTask : public Continuation {
279- ts_seconds frequency;
280- ts_hr_time start_time;
281-
282- virtual int sync_event (int event, void *edata) = 0;
283- int wait_event (int event, void *edata);
284-
285- HostDBBackgroundTask (ts_seconds frequency);
286- };
287-
288- HostDBBackgroundTask::HostDBBackgroundTask (ts_seconds frequency) : Continuation(new_ProxyMutex()), frequency(frequency)
289- {
290- SET_HANDLER (&HostDBBackgroundTask::sync_event);
291- }
292-
293256int
294257HostDBCache::start (int flags)
295258{
@@ -443,12 +406,6 @@ reply_to_cont(Continuation *cont, HostDBRecord *r, bool is_srv = false)
443406 return true ;
444407}
445408
446- inline HostResStyle
447- host_res_style_for (sockaddr const *ip)
448- {
449- return ats_is_ip6 (ip) ? HOST_RES_IPV6_ONLY : HOST_RES_IPV4_ONLY;
450- }
451-
452409inline HostResStyle
453410host_res_style_for (HostDBMark mark)
454411{
@@ -467,18 +424,6 @@ db_mark_for(HostResStyle style)
467424 return zret;
468425}
469426
470- inline HostDBMark
471- db_mark_for (sockaddr const *ip)
472- {
473- return ats_is_ip6 (ip) ? HOSTDB_MARK_IPV6 : HOSTDB_MARK_IPV4;
474- }
475-
476- inline HostDBMark
477- db_mark_for (IpAddr const &ip)
478- {
479- return ip.isIp6 () ? HOSTDB_MARK_IPV6 : HOSTDB_MARK_IPV4;
480- }
481-
482427HostDBRecord::Handle
483428probe_ip (HostDBHash const &hash)
484429{
@@ -784,29 +729,6 @@ HostDBProcessor::getbyname_imm(Continuation *cont, cb_process_result_pfn process
784729 return getby (cont, process_hostdb_info, hash, opt);
785730}
786731
787- Action *
788- HostDBProcessor::iterate (Continuation *cont)
789- {
790- ink_assert (cont->mutex ->thread_holding == this_ethread ());
791- EThread *thread = cont->mutex ->thread_holding ;
792-
793- Metrics::Counter::increment (hostdb_rsb.total_lookups );
794-
795- HostDBContinuation *c = hostDBContAllocator.alloc ();
796- HostDBContinuation::Options copt;
797- copt.cont = cont;
798- copt.force_dns = false ;
799- copt.timeout = 0 ;
800- copt.host_res_style = HOST_RES_NONE;
801- c->init (HostDBHash (), copt);
802- c->current_iterate_pos = 0 ;
803- SET_CONTINUATION_HANDLER (c, &HostDBContinuation::iterateEvent);
804-
805- thread->schedule_in (c, HOST_DB_RETRY_PERIOD);
806-
807- return &c->action ;
808- }
809-
810732// Lookup done, insert into the local table, return data to the
811733// calling continuation.
812734// NOTE: if "i" exists it means we already allocated the space etc, just return
@@ -1128,57 +1050,6 @@ HostDBContinuation::dnsEvent(int event, HostEnt *e)
11281050 }
11291051}
11301052
1131- int
1132- HostDBContinuation::iterateEvent (int event, Event *e)
1133- {
1134- Dbg (dbg_ctl_hostdb, " iterateEvent event=%d eventp=%p" , event, e);
1135- ink_assert (!link.prev && !link.next );
1136- EThread *t = e ? e->ethread : this_ethread ();
1137-
1138- MUTEX_TRY_LOCK (lock, action.mutex , t);
1139- if (!lock.is_locked ()) {
1140- Dbg (dbg_ctl_hostdb, " iterateEvent event=%d eventp=%p: reschedule due to not getting action mutex" , event, e);
1141- mutex->thread_holding ->schedule_in (this , HOST_DB_RETRY_PERIOD);
1142- return EVENT_CONT;
1143- }
1144-
1145- if (action.cancelled ) {
1146- hostdb_cont_free (this );
1147- return EVENT_DONE;
1148- }
1149-
1150- // let's iterate through another record and then reschedule ourself.
1151- if (current_iterate_pos < hostDB.refcountcache ->partition_count ()) {
1152- // TODO: configurable number at a time?
1153- ts::shared_mutex &bucket_lock = hostDB.refcountcache ->get_partition (current_iterate_pos).lock ;
1154- std::shared_lock<ts::shared_mutex> lock{bucket_lock};
1155-
1156- auto &partMap = hostDB.refcountcache ->get_partition (current_iterate_pos).get_map ();
1157- for (const auto &it : partMap) {
1158- auto *r = static_cast <HostDBRecord *>(it.item .get ());
1159- if (r && !r->is_failed ()) {
1160- action.continuation ->handleEvent (EVENT_INTERVAL, static_cast <void *>(r));
1161- }
1162- }
1163- current_iterate_pos++;
1164- }
1165-
1166- if (current_iterate_pos < hostDB.refcountcache ->partition_count ()) {
1167- // And reschedule ourselves to pickup the next bucket after HOST_DB_RETRY_PERIOD.
1168- Dbg (dbg_ctl_hostdb, " iterateEvent event=%d eventp=%p: completed current iteration %ld of %ld" , event, e, current_iterate_pos,
1169- hostDB.refcountcache ->partition_count ());
1170- mutex->thread_holding ->schedule_in (this , HOST_DB_ITERATE_PERIOD);
1171- return EVENT_CONT;
1172- } else {
1173- Dbg (dbg_ctl_hostdb, " iterateEvent event=%d eventp=%p: completed FINAL iteration %ld" , event, e, current_iterate_pos);
1174- // if there are no more buckets, then we're done.
1175- action.continuation ->handleEvent (EVENT_DONE, nullptr );
1176- hostdb_cont_free (this );
1177- }
1178-
1179- return EVENT_DONE;
1180- }
1181-
11821053//
11831054// Probe state
11841055//
@@ -1540,33 +1411,6 @@ ink_hostdb_init(ts::ModuleVersion v)
15401411 ts_host_res_global_init ();
15411412}
15421413
1543- struct HostDBFileContinuation : public Continuation {
1544- using self = HostDBFileContinuation;
1545- using Keys = std::vector<CryptoHash>;
1546-
1547- int idx = 0 ; // /< Working index.
1548- const char *name = nullptr ; // /< Host name (just for debugging)
1549- Keys *keys = nullptr ; // /< Entries from file.
1550- CryptoHash hash; // /< Key for entry.
1551- ats_scoped_str path; // /< Used to keep the host file name around.
1552-
1553- HostDBFileContinuation () : Continuation(nullptr ) {}
1554- // / Finish update
1555- static void finish (Keys *keys // /< Valid keys from update.
1556- );
1557- // / Clean up this instance.
1558- void destroy ();
1559- };
1560-
1561- ClassAllocator<HostDBFileContinuation> hostDBFileContAllocator (" hostDBFileContAllocator" );
1562-
1563- void
1564- HostDBFileContinuation::destroy ()
1565- {
1566- this ->~HostDBFileContinuation ();
1567- hostDBFileContAllocator.free (this );
1568- }
1569-
15701414// Host file processing globals.
15711415
15721416// We can't allow more than one update to be
0 commit comments