SolidWallOfCode commented on code in PR #9323:
URL: https://github.com/apache/trafficserver/pull/9323#discussion_r1103449443


##########
plugins/experimental/stek_share/stek_share.cc:
##########
@@ -57,11 +63,41 @@ shutdown_handler(TSCont contp, TSEvent event, void *edata)
   return 0;
 }
 
+static int
+message_handler(TSCont contp, TSEvent event, void *edata)
+{
+  if (event == TS_EVENT_LIFECYCLE_MSG) {
+    TSPluginMsg *msg = static_cast<TSPluginMsg *>(edata);
+    TSDebug(PLUGIN_NAME, "Message to '%s' - %zu bytes of data", msg->tag, 
msg->data_size);
+    if ((strnlen(msg->tag, 20) == 10) && (strncmp(msg->tag, PLUGIN_NAME, 10) 
== 0)) { // Message is for us
+      if (msg->data_size) {
+        if (strncmp(reinterpret_cast<char *>(const_cast<void *>(msg->data)), 
"reload", msg->data_size) == 0) {
+          TSDebug(PLUGIN_NAME, "Reloading configurations...");
+          plugin_threads.terminate();
+          stek_share_server.launcher_.shutdown();
+          if (set_server_info() == 0 && 
init_raft(nuraft::cs_new<STEKShareSM>()) == 0) {
+            TSDebug(PLUGIN_NAME, "Server ID: %d, Endpoint: %s", 
stek_share_server.server_id_, stek_share_server.endpoint_.c_str());
+            plugin_threads.reset();

Review Comment:
   I think the "I shut down my entire CDN because I distributed a bad STEK 
config" style is not going be popular.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to