TS-1953: Remove check_ts_version() from experimental plugins more axing: This time around, plugins/experimental. i'm noticing that we do expose TS_VERSION, so ignore most of my last commit message ;)
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/a8febbf5 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/a8febbf5 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/a8febbf5 Branch: refs/heads/3.3.x Commit: a8febbf50fecd6707e450d65febac27734b0864f Parents: 5b8b968 Author: Igor GaliÄ <[email protected]> Authored: Fri Aug 2 00:18:12 2013 +0200 Committer: Igor GaliÄ <[email protected]> Committed: Fri Aug 2 00:29:31 2013 +0200 ---------------------------------------------------------------------- .../experimental/channel_stats/channel_stats.cc | 29 ------------------ .../experimental/healthchecks/healthchecks.c | 27 ----------------- plugins/experimental/rfc5861/rfc5861.c | 31 -------------------- plugins/experimental/tcp_info/tcp_info.cc | 30 ------------------- 4 files changed, 117 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a8febbf5/plugins/experimental/channel_stats/channel_stats.cc ---------------------------------------------------------------------- diff --git a/plugins/experimental/channel_stats/channel_stats.cc b/plugins/experimental/channel_stats/channel_stats.cc index de5f757..5766bd0 100644 --- a/plugins/experimental/channel_stats/channel_stats.cc +++ b/plugins/experimental/channel_stats/channel_stats.cc @@ -794,31 +794,6 @@ api_handle_event(TSCont contp, TSEvent event, void *edata) // initial part -static int -check_ts_version() -{ - const char *ts_version = TSTrafficServerVersionGet(); - int result = 0; - - if (ts_version) { - int major_ts_version = 0; - int minor_ts_version = 0; - int patch_ts_version = 0; - - if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, - &patch_ts_version) != 3) { - return 0; - } - - // Need at least TS 3.0.0 - if (major_ts_version >= 3) { - result = 1; - } - } - - return result; -} - void TSPluginInit(int argc, const char *argv[]) { @@ -839,10 +814,6 @@ TSPluginInit(int argc, const char *argv[]) fatal("plugin registration failed."); } - if (!check_ts_version()) { - fatal("plugin requires Traffic Server 3.0.0 or later"); - } - info("%s(%s) plugin starting...", PLUGIN_NAME, PLUGIN_VERSION); stats_map_mutex = TSMutexCreate(); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a8febbf5/plugins/experimental/healthchecks/healthchecks.c ---------------------------------------------------------------------- diff --git a/plugins/experimental/healthchecks/healthchecks.c b/plugins/experimental/healthchecks/healthchecks.c index daf21b0..3c550b7 100644 --- a/plugins/experimental/healthchecks/healthchecks.c +++ b/plugins/experimental/healthchecks/healthchecks.c @@ -522,28 +522,6 @@ health_check_origin(TSCont contp ATS_UNUSED, TSEvent event ATS_UNUSED, void *eda return 0; } -/* Check the TS server version, make sure we're supporting it */ -inline int -check_ts_version() -{ - const char *ts_version = TSTrafficServerVersionGet(); - - if (ts_version) { - int major_ts_version = 0; - int minor_ts_version = 0; - int patch_ts_version = 0; - - if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version) != 3) - return 0; - - /* Need at least TS 3.0 */ - if (major_ts_version >= 3) - return 1; - } - - return 0; -} - /* Initialize the plugin / global continuation hook */ void TSPluginInit(int argc, const char *argv[]) @@ -564,11 +542,6 @@ TSPluginInit(int argc, const char *argv[]) return; } - if (!check_ts_version()) { - TSError("Plugin requires Traffic Server 3.0 or later\n"); - return; - } - /* This will update the global configuration file, and is not reloaded at run time */ /* ToDo: Support reloading with traffic_line -x ? */ if (NULL == (g_config = parse_configs(argv[1]))) { http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a8febbf5/plugins/experimental/rfc5861/rfc5861.c ---------------------------------------------------------------------- diff --git a/plugins/experimental/rfc5861/rfc5861.c b/plugins/experimental/rfc5861/rfc5861.c index 21c43e2..384aa91 100644 --- a/plugins/experimental/rfc5861/rfc5861.c +++ b/plugins/experimental/rfc5861/rfc5861.c @@ -709,31 +709,6 @@ rfc5861_plugin(TSCont cont, TSEvent event, void *edata) return 0; } -static bool -check_ts_version() -{ - const char *ts_version = TSTrafficServerVersionGet(); - - if (ts_version) - { - int major_ts_version = 0; - int minor_ts_version = 0; - int micro_ts_version = 0; - - if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, µ_ts_version) != 3) - { - return false; - } - - if ((TS_VERSION_MAJOR == major_ts_version) && (TS_VERSION_MINOR == minor_ts_version) && (TS_VERSION_MICRO == micro_ts_version)) - { - return true; - } - } - - return false; -} - void TSPluginInit (int argc, const char *argv[]) { @@ -754,12 +729,6 @@ TSPluginInit (int argc, const char *argv[]) TSDebug(LOG_PREFIX, "Plugin registration succeeded.\n"); } - if (!check_ts_version()) - { - TSError("Plugin requires Traffic Server %d.%d.%d\n", TS_VERSION_MAJOR, TS_VERSION_MINOR, TS_VERSION_MICRO); - return; - } - if (argc > 1) { int c; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a8febbf5/plugins/experimental/tcp_info/tcp_info.cc ---------------------------------------------------------------------- diff --git a/plugins/experimental/tcp_info/tcp_info.cc b/plugins/experimental/tcp_info/tcp_info.cc index 193d671..8a9d98b 100644 --- a/plugins/experimental/tcp_info/tcp_info.cc +++ b/plugins/experimental/tcp_info/tcp_info.cc @@ -261,31 +261,6 @@ done: return 0; } -int -check_ts_version() -{ - - const char *ts_version = TSTrafficServerVersionGet(); - int result = 0; - - if (ts_version) { - int major_ts_version = 0; - int minor_ts_version = 0; - int patch_ts_version = 0; - - if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version) != 3) { - return 0; - } - - /* Need at least TS 2.0 */ - if (major_ts_version >= 3) { - result = 1; - } - } - - return result; -} - void TSPluginInit(int, const char *[]) // int argc, const char *argv[] { @@ -298,11 +273,6 @@ TSPluginInit(int, const char *[]) // int argc, const char *argv[] if (TSPluginRegister(TS_SDK_VERSION_3_0, &info) != TS_SUCCESS) TSError("Plugin registration failed. \n"); - if (!check_ts_version()) { - TSError("Plugin requires Traffic Server 3.0 or later\n"); - return; - } - // load the configuration file load_config();
