This closes #TC-145

Add compile time defines depending on version of traffic server installed


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/824def67
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/824def67
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/824def67

Branch: refs/heads/master
Commit: 824def6777f02ea329a1de6922472c32f05dade4
Parents: 34c8fd6
Author: smalenfa <smalenf...@apache.org>
Authored: Mon Feb 13 15:52:01 2017 -0500
Committer: Jeff Elsloo <jeffrey_els...@cable.comcast.com>
Committed: Mon Feb 13 15:37:03 2017 -0700

----------------------------------------------------------------------
 .../plugins/astats_over_http/astats_over_http.c        | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/824def67/traffic_server/plugins/astats_over_http/astats_over_http.c
----------------------------------------------------------------------
diff --git a/traffic_server/plugins/astats_over_http/astats_over_http.c 
b/traffic_server/plugins/astats_over_http/astats_over_http.c
index 2894cb4..0eb6790 100644
--- a/traffic_server/plugins/astats_over_http/astats_over_http.c
+++ b/traffic_server/plugins/astats_over_http/astats_over_http.c
@@ -538,9 +538,15 @@ void TSPluginInit(int argc, const char *argv[]) {
        info.support_email = "jus...@fp-x.com";
        astatsLoad = time(NULL);
 
-       if (TSPluginRegister(&info) != TS_SUCCESS) {
-        TSError("Plugin registration failed. \n");
-       }
+       #if (TS_VERSION_NUMBER < 3000000)
+         if (TSPluginRegister(TS_SDK_VERSION_2_0, &info) != TS_SUCCESS) {
+       #elif (TS_VERSION_NUMBER < 6000000)
+         if (TSPluginRegister(TS_SDK_VERSION_3_0, &info) != TS_SUCCESS) {
+       #else
+         if (TSPluginRegister(&info) != TS_SUCCESS) {
+                       TSError("Plugin registration failed. \n");
+  #endif
+    }
 
        config_holder = new_config_holder(argc > 1 ? argv[1] : NULL);
 
@@ -860,4 +866,3 @@ static int config_handler(TSCont cont, TSEvent event, void 
*edata) {
        load_config_file(config_holder);
        return 0;
 }
-

Reply via email to