bneradt commented on code in PR #12645:
URL: https://github.com/apache/trafficserver/pull/12645#discussion_r2499607245
##########
plugins/header_rewrite/operators.cc:
##########
@@ -1800,3 +1800,44 @@ OperatorIf::exec_section(const CondOpSection *section,
const Resources &res) con
return section->ops.oper_mods;
}
+
+// OperatorSetCongestionCtrl
+void
+OperatorSetCCAlgorithm::initialize(Parser &p)
+{
+ Operator::initialize(p);
+ _cc_alg.set_value(p.get_arg());
+}
+
+void
+OperatorSetCCAlgorithm::initialize_hooks()
+{
+ add_allowed_hook(TS_REMAP_PSEUDO_HOOK);
+ add_allowed_hook(TS_HTTP_SEND_REQUEST_HDR_HOOK);
+ add_allowed_hook(TS_HTTP_READ_REQUEST_HDR_HOOK);
+ add_allowed_hook(TS_HTTP_PRE_REMAP_HOOK);
+}
+
+bool
+OperatorSetCCAlgorithm::exec(const Resources &res) const
+{
+ Dbg(dbg_ctl, "OperatorSetCCAlgorithm");
+
+ if (!res.state.txnp) {
+ TSError("[%s] OperatorSetCCAlgorithm() failed. Transaction is null",
PLUGIN_NAME);
+ return false;
+ }
+
+ int client_fd;
+ if (TSHttpTxnClientFdGet(res.state.txnp, &client_fd) != TS_SUCCESS) {
+ TSError("[OperatorSetCCAlgorithm] Error getting client fd");
Review Comment:
It is good to include PLUGIN_NAME in the error messages, as you did abve at
line 1827. Otherwise our ops friends don't have an easy way to know where the
message comes from.
##########
plugins/header_rewrite/operators.cc:
##########
@@ -1800,3 +1800,44 @@ OperatorIf::exec_section(const CondOpSection *section,
const Resources &res) con
return section->ops.oper_mods;
}
+
+// OperatorSetCongestionCtrl
+void
+OperatorSetCCAlgorithm::initialize(Parser &p)
+{
+ Operator::initialize(p);
+ _cc_alg.set_value(p.get_arg());
+}
+
+void
+OperatorSetCCAlgorithm::initialize_hooks()
+{
+ add_allowed_hook(TS_REMAP_PSEUDO_HOOK);
+ add_allowed_hook(TS_HTTP_SEND_REQUEST_HDR_HOOK);
+ add_allowed_hook(TS_HTTP_READ_REQUEST_HDR_HOOK);
+ add_allowed_hook(TS_HTTP_PRE_REMAP_HOOK);
+}
+
+bool
+OperatorSetCCAlgorithm::exec(const Resources &res) const
+{
+ Dbg(dbg_ctl, "OperatorSetCCAlgorithm");
+
+ if (!res.state.txnp) {
+ TSError("[%s] OperatorSetCCAlgorithm() failed. Transaction is null",
PLUGIN_NAME);
+ return false;
+ }
+
+ int client_fd;
+ if (TSHttpTxnClientFdGet(res.state.txnp, &client_fd) != TS_SUCCESS) {
+ TSError("[OperatorSetCCAlgorithm] Error getting client fd");
+ }
+
+#ifdef TCP_CONGESTION
+ if (safe_setsockopt(client_fd, IPPROTO_TCP, TCP_CONGESTION,
_cc_alg.get_value().data(), _cc_alg.size()) == -1) {
+ TSError("[OperatorSetCCAlgorithm] Error setting congestion control
algorithm, errno=%d %s", errno, strerror(errno));
Review Comment:
PLUGIN_NAME
--
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]