SolidWallOfCode commented on code in PR #9358:
URL: https://github.com/apache/trafficserver/pull/9358#discussion_r1103406276
##########
iocore/net/P_SNIActionPerformer.h:
##########
@@ -89,12 +89,73 @@ class HTTP2BufferWaterMark : public ActionItem
class TunnelDestination : public ActionItem
{
+ // ID of the configured variable. This will be used to know which function
+ // should be called when processing the tunnel destination.
+ enum OpId : int32_t {
+ DEFAULT = -1, // No specific variable set.
+ MATCH_GROUPS, // Deal with configured groups.
+ MAP_WITH_RECV_PORT, // Use port from inbound local
+ MAP_WITH_PROXY_PROTOCOL_PORT, // Use port from the proxy protocol
+ MAX // Always at the end and do not change the
value of the above items.
+ };
+ const std::string MAP_WITH_RECV_PORT_STR = "{inbound_local_port}";
+ const std::string MAP_WITH_PROXY_PROTOCOL_PORT_STR = "{proxy_protocol_port}";
+
public:
TunnelDestination(const std::string_view &dest, SNIRoutingType type,
YamlSNIConfig::TunnelPreWarm prewarm,
const std::vector<int> &alpn)
: destination(dest), type(type), tunnel_prewarm(prewarm), alpn_ids(alpn)
{
- need_fix = (destination.find_first_of('$') != std::string::npos);
+ std::size_t var_start_pos{0}; // keep the starting position of the
variable.
+ if (destination.find_first_of('$') != std::string::npos) {
+ fnArrIndex = OpId::MATCH_GROUPS;
+ } else if (var_start_pos = destination.find(MAP_WITH_RECV_PORT_STR);
var_start_pos != std::string::npos) {
+ fnArrIndex = OpId::MAP_WITH_RECV_PORT;
+ } else if (var_start_pos =
destination.find(MAP_WITH_PROXY_PROTOCOL_PORT_STR); var_start_pos !=
std::string::npos) {
+ fnArrIndex = OpId::MAP_WITH_PROXY_PROTOCOL_PORT;
+ }
+
Review Comment:
What is `fnArrIndex` if none of the checks match?
--
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]