traeak commented on code in PR #12593:
URL: https://github.com/apache/trafficserver/pull/12593#discussion_r4484244318
##########
src/proxy/http/remap/NextHopStrategyFactory.cc:
##########
@@ -167,23 +175,26 @@ NextHopStrategyFactory::createStrategy(const std::string
&name, const NHPolicyTy
NextHopSelectionStrategy *
NextHopStrategyFactory::strategyInstance(const char *name) const
{
- NextHopSelectionStrategy *ps_strategy = nullptr;
-
+ // Called from transaction threads, must not mutate strategy state.
if (!strategies_loaded) {
- NH_Error("no strategy configurations were defined, see definitions in '%s'
file", fn.c_str());
- return nullptr;
- } else {
- auto it = _strategies.find(name);
- if (it == _strategies.end()) {
- // NH_Error("no strategy found for name: %s", name);
- return nullptr;
- } else {
- ps_strategy = it->second;
- ps_strategy->distance = std::distance(_strategies.begin(), it);
+ if (!_not_loaded_logged.exchange(true, std::memory_order_relaxed)) {
+ NH_Error("no strategy configurations were defined, see definitions in
'%s' file", fn.c_str());
}
+ return nullptr;
}
- return ps_strategy;
+ if (name == nullptr) {
+ return nullptr;
+ }
+
+ auto it = _strategies.find(name);
+ return (it == _strategies.end()) ? nullptr : it->second;
+}
+
+bool
+NextHopStrategyFactory::contains(NextHopSelectionStrategy const *strategy)
const
+{
+ return _strategy_ptrs.contains(strategy);
Review Comment:
This is core code, and the project compiles core as C++20
(CMAKE_CXX_STANDARD 20). The C++17 minimum only applies to plugin headers, and
contains isn't in any header.
--
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]