You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2012/12/13 07:45:02 UTC
[7/7] git commit: TS-1621: Adopt the ConfigUpdateHandler pattern for
SplitDNS updates
TS-1621: Adopt the ConfigUpdateHandler pattern for SplitDNS updates
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/472c6131
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/472c6131
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/472c6131
Branch: refs/heads/master
Commit: 472c6131369dc36ad943858c54e9248fc0c0a9e3
Parents: 7e1169c
Author: Ethan Lai <yz...@yahoo.com>
Authored: Wed Dec 12 21:58:57 2012 -0800
Committer: James Peach <jp...@apache.org>
Committed: Wed Dec 12 22:03:12 2012 -0800
----------------------------------------------------------------------
iocore/dns/P_SplitDNSProcessor.h | 38 ---------------------------------
iocore/dns/SplitDNS.cc | 20 ++++-------------
2 files changed, 5 insertions(+), 53 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/472c6131/iocore/dns/P_SplitDNSProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/dns/P_SplitDNSProcessor.h b/iocore/dns/P_SplitDNSProcessor.h
index e5a11fe..b83d1fc 100644
--- a/iocore/dns/P_SplitDNSProcessor.h
+++ b/iocore/dns/P_SplitDNSProcessor.h
@@ -267,44 +267,6 @@ TS_INLINE SplitDNSRecord::~SplitDNSRecord()
{ }
-/* --------------------------------------------------------------
- struct SDNS_UpdateContinuation
- Used to handle parent.conf or default parent updates after the
- manager signals a change
- -------------------------------------------------------------- */
-struct SDNS_UpdateContinuation: public Continuation
-{
- int handle_event(int event, void *data);
- SDNS_UpdateContinuation(ProxyMutex * m);
-
-};
-
-
-/* --------------------------------------------------------------
- SDNS_UpdateContinuation::SDNS_UpdateContinuation()
- -------------------------------------------------------------- */
-TS_INLINE SDNS_UpdateContinuation::SDNS_UpdateContinuation(ProxyMutex * m)
-: Continuation(m)
-{
- SET_HANDLER(&SDNS_UpdateContinuation::handle_event);
-}
-
-
-/* --------------------------------------------------------------
- SDNS_UpdateContinuation::handle_event()
- -------------------------------------------------------------- */
-TS_INLINE int
-SDNS_UpdateContinuation::handle_event(int event, void *data)
-{
- NOWARN_UNUSED(event);
- NOWARN_UNUSED(data);
-
- SplitDNSConfig::reconfigure();
- delete this;
-
- return EVENT_DONE;
-}
-
/* ------------------
Helper Functions
------------------ */
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/472c6131/iocore/dns/SplitDNS.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/SplitDNS.cc b/iocore/dns/SplitDNS.cc
index ca98554..34356e3 100644
--- a/iocore/dns/SplitDNS.cc
+++ b/iocore/dns/SplitDNS.cc
@@ -45,7 +45,8 @@
globals
-------------------------------------------------------------- */
static const char modulePrefix[] = "[SplitDNS]";
-static Ptr<ProxyMutex> reconfig_mutex = NULL;
+
+static ConfigUpdateHandler<SplitDNSConfig> * splitDNSUpdate;
static ClassAllocator<DNSRequestData> DNSReqAllocator("DNSRequestDataAllocator");
@@ -127,18 +128,19 @@ SplitDNSConfig::release(SplitDNS * params)
configProcessor.release(SplitDNSConfig::m_id, params);
}
+
/* --------------------------------------------------------------
SplitDNSConfig::startup()
-------------------------------------------------------------- */
void
SplitDNSConfig::startup()
{
- reconfig_mutex = new_ProxyMutex();
dnsHandler_mutex = new_ProxyMutex();
//startup just check gsplit_dns_enabled
IOCORE_ReadConfigInt32(gsplit_dns_enabled, "proxy.config.dns.splitDNS.enabled");
- REC_RegisterConfigUpdateFunc("proxy.config.dns.splitdns.filename", splitDNSFile_CB, NULL);
+ splitDNSUpdate = NEW(new ConfigUpdateHandler<SplitDNSConfig>());
+ splitDNSUpdate->attach("proxy.config.cache.splitdns.filename");
}
@@ -593,16 +595,4 @@ ink_split_dns_init(ModuleVersion v)
init_called = 1;
}
-
-int
-splitDNSFile_CB(const char *name, RecDataT data_type, RecData data, void *cookie)
-{
- NOWARN_UNUSED(name);
- NOWARN_UNUSED(data_type);
- NOWARN_UNUSED(data);
- NOWARN_UNUSED(cookie);
- eventProcessor.schedule_imm(NEW(new SDNS_UpdateContinuation(reconfig_mutex)), ET_CACHE);
- return 0;
-}
-
#endif // SPLIT_DNS