Copilot commented on code in PR #13278:
URL: https://github.com/apache/trafficserver/pull/13278#discussion_r3439507009


##########
src/proxy/Plugin.cc:
##########
@@ -215,7 +243,17 @@ single_plugin_init(int argc, char *argv[], bool 
validateOnly)
 #endif
     opterr = 0;
     optarg = nullptr;
+
+    // Install this plugin's context around TSPluginInit so the continuations 
it creates carry its
+    // identity (see GlobalPluginContext).
+    auto *global_context = new GlobalPluginContext(path);
+    g_global_plugin_contexts.push_back(global_context);
+    auto *prev_plugin_context = pluginThreadContext;
+    pluginThreadContext       = global_context;
+
     init(argc, argv);
+
+    pluginThreadContext = prev_plugin_context;

Review Comment:
   `GlobalPluginContext` calls `PluginThreadContext::registerPluginMetrics()`, 
but that method is implemented in `src/proxy/http/remap/PluginDso.cc` (the 
`ts::http_remap` library). This introduces a new link-time dependency from 
`ts::proxy` (where `Plugin.cc` lives) onto `ts::http_remap`, which is not 
currently expressed in CMake and will break targets that link `ts::proxy` 
without also linking `ts::http_remap` (e.g. `src/proxy/unit_tests/test_proxy`). 
Consider moving `PluginThreadContext` (and its metric registration helper) into 
`ts::proxy`, or making `registerPluginMetrics()` header-inline, so `ts::proxy` 
no longer depends on `ts::http_remap` for this symbol.



-- 
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