trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bc...@apache.org
Subject [trafficserver] branch 8.0.x updated: Make atscppapi::RegisterGlobalPlugin return a value.
Date Thu, 21 Jun 2018 18:06:41 GMT
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/8.0.x by this push:
     new 37e5375  Make atscppapi::RegisterGlobalPlugin return a value.
37e5375 is described below

commit 37e537572e8538430b4b9cdb4b2d263ca2ffca9d
Author: David Calavera <david.calavera@gmail.com>
AuthorDate: Sun Jun 17 19:55:07 2018 -0700

    Make atscppapi::RegisterGlobalPlugin return a value.
    
    This way, the plugin caller can decide whether to abort or not.
    Update all examples where it's used.
    
    Signed-off-by: David Calavera <david.calavera@gmail.com>
    (cherry picked from commit 672daf221201537a32ff9b7e6978288388564433)
---
 example/cppapi/async_http_fetch/AsyncHttpFetch.cc                  | 4 +++-
 .../cppapi/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc   | 4 +++-
 example/cppapi/async_timer/AsyncTimer.cc                           | 4 +++-
 example/cppapi/boom/boom.cc                                        | 4 +++-
 example/cppapi/clientredirect/ClientRedirect.cc                    | 4 +++-
 example/cppapi/clientrequest/ClientRequest.cc                      | 4 +++-
 example/cppapi/customresponse/CustomResponse.cc                    | 4 +++-
 .../delay_transformation_plugin/DelayTransformationPlugin.cc       | 4 +++-
 example/cppapi/globalhook/GlobalHookPlugin.cc                      | 4 +++-
 example/cppapi/gzip_transformation/GzipTransformationPlugin.cc     | 4 +++-
 example/cppapi/helloworld/HelloWorldPlugin.cc                      | 4 +++-
 example/cppapi/intercept/intercept.cc                              | 4 +++-
 .../internal_transaction_handling/InternalTransactionHandling.cc   | 4 +++-
 example/cppapi/logger_example/LoggerExample.cc                     | 4 +++-
 .../multiple_transaction_hooks/MultipleTransactionHookPlugins.cc   | 4 +++-
 .../cppapi/null_transformation_plugin/NullTransformationPlugin.cc  | 4 +++-
 example/cppapi/post_buffer/PostBuffer.cc                           | 4 +++-
 example/cppapi/serverresponse/ServerResponse.cc                    | 4 +++-
 example/cppapi/stat_example/StatExample.cc                         | 4 +++-
 example/cppapi/timeout_example/TimeoutExamplePlugin.cc             | 4 +++-
 example/cppapi/transactionhook/TransactionHookPlugin.cc            | 4 +++-
 example/cppapi/websocket/WebSocket.cc                              | 4 +++-
 lib/cppapi/Plugin.cc                                               | 7 +++++--
 lib/cppapi/include/atscppapi/Plugin.h                              | 6 +++---
 plugins/experimental/server_push_preload/server_push_preload.cc    | 4 +++-
 plugins/experimental/webp_transform/ImageTransform.cc              | 4 +++-
 26 files changed, 80 insertions(+), 29 deletions(-)

diff --git a/example/cppapi/async_http_fetch/AsyncHttpFetch.cc b/example/cppapi/async_http_fetch/AsyncHttpFetch.cc
index b615a7c..a74cef8 100644
--- a/example/cppapi/async_http_fetch/AsyncHttpFetch.cc
+++ b/example/cppapi/async_http_fetch/AsyncHttpFetch.cc
@@ -218,6 +218,8 @@ void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
   TS_DEBUG(TAG, "Loaded async_http_fetch_example plugin");
-  RegisterGlobalPlugin("CPP_Example_AsyncHttpFetch", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_AsyncHttpFetch", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   plugin = new GlobalHookPlugin();
 }
diff --git a/example/cppapi/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc b/example/cppapi/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc
index 412ced8..3dd4041 100644
--- a/example/cppapi/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc
+++ b/example/cppapi/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc
@@ -79,7 +79,9 @@ public:
 void
 TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
 {
-  RegisterGlobalPlugin("CPP_Example_AsyncHttpFetchStreaming", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_AsyncHttpFetchStreaming", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   plugin = new InterceptInstaller();
 }
 
diff --git a/example/cppapi/async_timer/AsyncTimer.cc b/example/cppapi/async_timer/AsyncTimer.cc
index b08bbee..229f219 100644
--- a/example/cppapi/async_timer/AsyncTimer.cc
+++ b/example/cppapi/async_timer/AsyncTimer.cc
@@ -60,7 +60,9 @@ private:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_AsyncTimer", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_AsyncTimer", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   int period_in_ms           = 1000;
   TimerEventReceiver *timer1 = new TimerEventReceiver(AsyncTimer::TYPE_PERIODIC, period_in_ms);
   TS_DEBUG(TAG, "Created periodic timer %p with initial period 0, regular period %d and max
instances 0", timer1, period_in_ms);
diff --git a/example/cppapi/boom/boom.cc b/example/cppapi/boom/boom.cc
index da790dd..4ac36d2 100644
--- a/example/cppapi/boom/boom.cc
+++ b/example/cppapi/boom/boom.cc
@@ -433,7 +433,9 @@ BoomGlobalPlugin::handleReadResponseHeaders(Transaction &transaction)
 void
 TSPluginInit(int argc, const char *argv[])
 {
-  RegisterGlobalPlugin("CPP_Example_Boom", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_Boom", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   boom_counter.init(BOOM_COUNTER);
   BoomResponseRegistry *pregistry = new BoomResponseRegistry();
 
diff --git a/example/cppapi/clientredirect/ClientRedirect.cc b/example/cppapi/clientredirect/ClientRedirect.cc
index 051d8f6..8206c48 100644
--- a/example/cppapi/clientredirect/ClientRedirect.cc
+++ b/example/cppapi/clientredirect/ClientRedirect.cc
@@ -80,6 +80,8 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_ClientDirect", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_ClientDirect", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   plugin = new ClientRedirectGlobalPlugin();
 }
diff --git a/example/cppapi/clientrequest/ClientRequest.cc b/example/cppapi/clientrequest/ClientRequest.cc
index a608e36..93baaa2 100644
--- a/example/cppapi/clientrequest/ClientRequest.cc
+++ b/example/cppapi/clientrequest/ClientRequest.cc
@@ -137,6 +137,8 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_ClientRequest", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_ClientRequest", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   plugin = new GlobalHookPlugin();
 }
diff --git a/example/cppapi/customresponse/CustomResponse.cc b/example/cppapi/customresponse/CustomResponse.cc
index 69ed4a9..d422482 100644
--- a/example/cppapi/customresponse/CustomResponse.cc
+++ b/example/cppapi/customresponse/CustomResponse.cc
@@ -88,6 +88,8 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_CustomResponse", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_CustomResponse", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   plugin = new ClientRedirectGlobalPlugin();
 }
diff --git a/example/cppapi/delay_transformation_plugin/DelayTransformationPlugin.cc b/example/cppapi/delay_transformation_plugin/DelayTransformationPlugin.cc
index 3733b7e..7c410a4 100644
--- a/example/cppapi/delay_transformation_plugin/DelayTransformationPlugin.cc
+++ b/example/cppapi/delay_transformation_plugin/DelayTransformationPlugin.cc
@@ -116,7 +116,9 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_DelayTransformation", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_DelayTransformation", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   TS_DEBUG(TAG, "TSPluginInit");
   plugin = new GlobalHookPlugin();
 }
diff --git a/example/cppapi/globalhook/GlobalHookPlugin.cc b/example/cppapi/globalhook/GlobalHookPlugin.cc
index cccf900..d3efecd 100644
--- a/example/cppapi/globalhook/GlobalHookPlugin.cc
+++ b/example/cppapi/globalhook/GlobalHookPlugin.cc
@@ -44,7 +44,9 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_GlobalHookPplugin", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_GlobalHookPplugin", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   std::cout << "Hello from " << argv[0] << std::endl;
   plugin = new GlobalHookPlugin();
 }
diff --git a/example/cppapi/gzip_transformation/GzipTransformationPlugin.cc b/example/cppapi/gzip_transformation/GzipTransformationPlugin.cc
index 6a52b4b..f0219b1 100644
--- a/example/cppapi/gzip_transformation/GzipTransformationPlugin.cc
+++ b/example/cppapi/gzip_transformation/GzipTransformationPlugin.cc
@@ -198,7 +198,9 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_GzipTransformation", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_GzipTransformation", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   TS_DEBUG(TAG, "TSPluginInit");
   plugin = new GlobalHookPlugin();
 }
diff --git a/example/cppapi/helloworld/HelloWorldPlugin.cc b/example/cppapi/helloworld/HelloWorldPlugin.cc
index 981b56e..3532f85 100644
--- a/example/cppapi/helloworld/HelloWorldPlugin.cc
+++ b/example/cppapi/helloworld/HelloWorldPlugin.cc
@@ -35,7 +35,9 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
+  if (!atscppapi::RegisterGlobalPlugin("CPP_Example_HelloWorld", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   std::cout << "Hello from " << argv[0] << std::endl;
-  atscppapi::RegisterGlobalPlugin("CPP_Example_HelloWorld", "apache", "dev@trafficserver.apache.org");
   plugin = new HelloWorldPlugin();
 }
diff --git a/example/cppapi/intercept/intercept.cc b/example/cppapi/intercept/intercept.cc
index b98ba6e..51ee42e 100644
--- a/example/cppapi/intercept/intercept.cc
+++ b/example/cppapi/intercept/intercept.cc
@@ -60,7 +60,9 @@ public:
 void
 TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
 {
-  RegisterGlobalPlugin("CPP_Example_Intercept", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_Intercept", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   plugin = new InterceptInstaller();
 }
 
diff --git a/example/cppapi/internal_transaction_handling/InternalTransactionHandling.cc b/example/cppapi/internal_transaction_handling/InternalTransactionHandling.cc
index 3adc1ec..dc85afd 100644
--- a/example/cppapi/internal_transaction_handling/InternalTransactionHandling.cc
+++ b/example/cppapi/internal_transaction_handling/InternalTransactionHandling.cc
@@ -76,7 +76,9 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_InternalTransactionHandling", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_InternalTransactionHandling", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   TS_DEBUG(TAG, "Loaded async_http_fetch_example plugin");
   plugin  = new AllTransactionsGlobalPlugin();
   plugin2 = new NoInternalTransactionsGlobalPlugin();
diff --git a/example/cppapi/logger_example/LoggerExample.cc b/example/cppapi/logger_example/LoggerExample.cc
index 84a6d6b..14403ae 100644
--- a/example/cppapi/logger_example/LoggerExample.cc
+++ b/example/cppapi/logger_example/LoggerExample.cc
@@ -103,7 +103,9 @@ private:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_Logger", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_Logger", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   // Create a new logger
   // This will create a log file with the name logger_example.log (since we left off
   //    the extension it will automatically add .log)
diff --git a/example/cppapi/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc b/example/cppapi/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc
index 372a5fe..bfcdde1 100644
--- a/example/cppapi/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc
+++ b/example/cppapi/multiple_transaction_hooks/MultipleTransactionHookPlugins.cc
@@ -105,6 +105,8 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_MultipleTransactionHook", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_MultipleTransactionHook", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   plugin = new GlobalHookPlugin();
 }
diff --git a/example/cppapi/null_transformation_plugin/NullTransformationPlugin.cc b/example/cppapi/null_transformation_plugin/NullTransformationPlugin.cc
index 598d49f..67a7020 100644
--- a/example/cppapi/null_transformation_plugin/NullTransformationPlugin.cc
+++ b/example/cppapi/null_transformation_plugin/NullTransformationPlugin.cc
@@ -100,7 +100,9 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_NullTransformation", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_NullTransformation", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   TS_DEBUG(TAG, "TSPluginInit");
   plugin = new GlobalHookPlugin();
 }
diff --git a/example/cppapi/post_buffer/PostBuffer.cc b/example/cppapi/post_buffer/PostBuffer.cc
index cc3ecf2..984d105 100644
--- a/example/cppapi/post_buffer/PostBuffer.cc
+++ b/example/cppapi/post_buffer/PostBuffer.cc
@@ -84,6 +84,8 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_PostBuffer", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_PostBuffer", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   plugin = new GlobalHookPlugin();
 }
diff --git a/example/cppapi/serverresponse/ServerResponse.cc b/example/cppapi/serverresponse/ServerResponse.cc
index fcf175e..0f9c901 100644
--- a/example/cppapi/serverresponse/ServerResponse.cc
+++ b/example/cppapi/serverresponse/ServerResponse.cc
@@ -118,6 +118,8 @@ private:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_ServerResponse", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_ServerResponse", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   plugin = new ServerResponsePlugin();
 }
diff --git a/example/cppapi/stat_example/StatExample.cc b/example/cppapi/stat_example/StatExample.cc
index 587f3ff..bdc3d19 100644
--- a/example/cppapi/stat_example/StatExample.cc
+++ b/example/cppapi/stat_example/StatExample.cc
@@ -68,7 +68,9 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_Stat", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_Stat", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   TS_DEBUG(TAG, "Loaded stat_example plugin");
 
   // Since this stat is not persistent it will be initialized to 0.
diff --git a/example/cppapi/timeout_example/TimeoutExamplePlugin.cc b/example/cppapi/timeout_example/TimeoutExamplePlugin.cc
index d2b3120..3cd54ff 100644
--- a/example/cppapi/timeout_example/TimeoutExamplePlugin.cc
+++ b/example/cppapi/timeout_example/TimeoutExamplePlugin.cc
@@ -61,7 +61,9 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_Timeout", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_Timeout", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   TS_DEBUG(TAG, "TSPluginInit");
   plugin = new TimeoutExamplePlugin();
 }
diff --git a/example/cppapi/transactionhook/TransactionHookPlugin.cc b/example/cppapi/transactionhook/TransactionHookPlugin.cc
index c89dec0..add9164 100644
--- a/example/cppapi/transactionhook/TransactionHookPlugin.cc
+++ b/example/cppapi/transactionhook/TransactionHookPlugin.cc
@@ -69,6 +69,8 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Example_TransactionHook", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_TransactionHook", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   plugin = new GlobalHookPlugin();
 }
diff --git a/example/cppapi/websocket/WebSocket.cc b/example/cppapi/websocket/WebSocket.cc
index d0da601..4b14b8c 100644
--- a/example/cppapi/websocket/WebSocket.cc
+++ b/example/cppapi/websocket/WebSocket.cc
@@ -38,7 +38,9 @@ using namespace atscppapi;
 void
 TSPluginInit(int argc, const char *argv[])
 {
-  RegisterGlobalPlugin("CPP_Example_WebSocket", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Example_WebSocket", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   plugin = new WebSocketInstaller(); // We keep a pointer to this so that clang-analyzer
doesn't think it's a leak
 }
 
diff --git a/lib/cppapi/Plugin.cc b/lib/cppapi/Plugin.cc
index 22925c3..ee4dd20 100644
--- a/lib/cppapi/Plugin.cc
+++ b/lib/cppapi/Plugin.cc
@@ -28,14 +28,17 @@ const std::string atscppapi::HOOK_TYPE_STRINGS[] = {
   std::string("HOOK_READ_REQUEST_HEADERS"),           std::string("HOOK_READ_CACHE_HEADERS"),
   std::string("HOOK_CACHE_LOOKUP_COMPLETE"),          std::string("HOOK_SELECT_ALT")};
 
-void
+bool
 atscppapi::RegisterGlobalPlugin(const char *name, const char *vendor, const char *email)
 {
   TSPluginRegistrationInfo info;
   info.plugin_name   = name;
   info.vendor_name   = vendor;
   info.support_email = email;
-  if (TSPluginRegister(&info) != TS_SUCCESS) {
+
+  bool success = (TSPluginRegister(&info) == TS_SUCCESS);
+  if (!success) {
     TSError("[Plugin.cc] Plugin registration failed");
   }
+  return success;
 }
diff --git a/lib/cppapi/include/atscppapi/Plugin.h b/lib/cppapi/include/atscppapi/Plugin.h
index 6e42fa9..fce1dae 100644
--- a/lib/cppapi/include/atscppapi/Plugin.h
+++ b/lib/cppapi/include/atscppapi/Plugin.h
@@ -162,11 +162,11 @@ protected:
 /**< Human readable strings for each HookType, you can access them as HOOK_TYPE_STRINGS[HOOK_OS_DNS]
for example. */
 extern const std::string HOOK_TYPE_STRINGS[];
 
-void RegisterGlobalPlugin(const char *name, const char *vendor, const char *email);
-inline void
+bool RegisterGlobalPlugin(const char *name, const char *vendor, const char *email);
+inline bool
 RegisterGlobalPlugin(std::string const &name, std::string const &vendor, std::string
const &email)
 {
-  RegisterGlobalPlugin(name.c_str(), vendor.c_str(), email.c_str());
+  return RegisterGlobalPlugin(name.c_str(), vendor.c_str(), email.c_str());
 }
 
 } // namespace atscppapi
diff --git a/plugins/experimental/server_push_preload/server_push_preload.cc b/plugins/experimental/server_push_preload/server_push_preload.cc
index a0fb767..1147c93 100644
--- a/plugins/experimental/server_push_preload/server_push_preload.cc
+++ b/plugins/experimental/server_push_preload/server_push_preload.cc
@@ -138,6 +138,8 @@ void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
   TSDebug(PLUGIN_NAME, "Init");
-  RegisterGlobalPlugin("ServerPushPreloadPlugin", PLUGIN_NAME, "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("ServerPushPreloadPlugin", PLUGIN_NAME, "dev@trafficserver.apache.org"))
{
+    return;
+  }
   plugin = new LinkServerPushPlugin();
 }
diff --git a/plugins/experimental/webp_transform/ImageTransform.cc b/plugins/experimental/webp_transform/ImageTransform.cc
index 56c09c4..fb64186 100644
--- a/plugins/experimental/webp_transform/ImageTransform.cc
+++ b/plugins/experimental/webp_transform/ImageTransform.cc
@@ -99,7 +99,9 @@ public:
 void
 TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] ATSCPPAPI_UNUSED)
 {
-  RegisterGlobalPlugin("CPP_Webp_Transform", "apache", "dev@trafficserver.apache.org");
+  if (!RegisterGlobalPlugin("CPP_Webp_Transform", "apache", "dev@trafficserver.apache.org"))
{
+    return;
+  }
   InitializeMagick("");
   new GlobalHookPlugin();
 }


Mime
View raw message