[trafficserver] 01/01: Add TSVConnFdGet api (#10324)

2023-10-06 Thread bcall
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 791ab96864875d9e017571e04a9fa2cf5dcf7a09
Author: Susan Hinrichs 
AuthorDate: Mon Sep 11 17:51:33 2023 -0500

Add TSVConnFdGet api (#10324)

(cherry picked from commit 7ddb721c4ff4e1943a3d92b889b346d398fe8756)

 Conflicts:
include/ts/ts.h
src/traffic_server/InkAPI.cc
---
 .../api/functions/TSVConnFdGet.en.rst  | 34 ++
 include/ts/ts.h|  2 ++
 src/traffic_server/InkAPI.cc   |  8 +
 3 files changed, 44 insertions(+)

diff --git a/doc/developer-guide/api/functions/TSVConnFdGet.en.rst 
b/doc/developer-guide/api/functions/TSVConnFdGet.en.rst
new file mode 100644
index 00..7e5a808115
--- /dev/null
+++ b/doc/developer-guide/api/functions/TSVConnFdGet.en.rst
@@ -0,0 +1,34 @@
+.. Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed
+   with this work for additional information regarding copyright
+   ownership.  The ASF licenses this file to you under the Apache
+   License, Version 2.0 (the "License"); you may not use this file
+   except in compliance with the License.  You may obtain a copy of
+   the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied.  See the License for the specific language governing
+   permissions and limitations under the License.
+
+
+TSVConnFdGet
+
+
+Synopsis
+
+
+.. code-block:: cpp
+
+#include 
+
+.. c:function:: int TSVConnFdGet(TSVConn vconnp)
+
+
+Description
+---
+Returns the file descriptor associated with the network connection :arg:`sslp`.
+It returns -1 on error.
diff --git a/include/ts/ts.h b/include/ts/ts.h
index 226b3c6f1e..6b39abf925 100644
--- a/include/ts/ts.h
+++ b/include/ts/ts.h
@@ -1219,6 +1219,8 @@ tsapi void TSVConnReenable(TSVConn sslvcp);
 tsapi TSReturnCode TSVConnTunnel(TSVConn sslp);
 /*  Return the SSL object associated with the connection */
 tsapi TSSslConnection TSVConnSSLConnectionGet(TSVConn sslp);
+/* Return the file descriptoer associated with the connection */
+tsapi int TSVConnFdGet(TSVConn sslp);
 /*  Fetch a SSL context from the global lookup table */
 tsapi TSSslContext TSSslContextFindByName(const char *name);
 tsapi TSSslContext TSSslContextFindByAddr(struct sockaddr const *);
diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc
index 56d135107d..2d878123ea 100644
--- a/src/traffic_server/InkAPI.cc
+++ b/src/traffic_server/InkAPI.cc
@@ -9199,6 +9199,14 @@ TSVConnSSLConnectionGet(TSVConn sslp)
   return ssl;
 }
 
+tsapi int
+TSVConnFdGet(TSVConn vconnp)
+{
+  sdk_assert(sdk_sanity_check_null_ptr(vconnp) == TS_SUCCESS);
+  NetVConnection *vc = reinterpret_cast(vconnp);
+  return vc->get_socket();
+}
+
 tsapi TSSslContext
 TSSslContextFindByName(const char *name)
 {



[trafficserver] branch 8.1.x updated (5347c81e1c -> 791ab96864)

2023-10-06 Thread bcall
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a change to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


 discard 5347c81e1c Add TSVConnFdGet api (#10324)
 new 791ab96864 Add TSVConnFdGet api (#10324)

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (5347c81e1c)
\
 N -- N -- N   refs/heads/8.1.x (791ab96864)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/traffic_server/InkAPI.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[trafficserver] branch 8.1.x updated: Add TSVConnFdGet api (#10324)

2023-10-06 Thread bcall
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/8.1.x by this push:
 new 5347c81e1c Add TSVConnFdGet api (#10324)
5347c81e1c is described below

commit 5347c81e1c5349ebee9495d5d92a8e209de8b40e
Author: Susan Hinrichs 
AuthorDate: Mon Sep 11 17:51:33 2023 -0500

Add TSVConnFdGet api (#10324)

(cherry picked from commit 7ddb721c4ff4e1943a3d92b889b346d398fe8756)

 Conflicts:
include/ts/ts.h
src/traffic_server/InkAPI.cc
---
 .../api/functions/TSVConnFdGet.en.rst  | 34 ++
 include/ts/ts.h|  2 ++
 src/traffic_server/InkAPI.cc   |  8 +
 3 files changed, 44 insertions(+)

diff --git a/doc/developer-guide/api/functions/TSVConnFdGet.en.rst 
b/doc/developer-guide/api/functions/TSVConnFdGet.en.rst
new file mode 100644
index 00..7e5a808115
--- /dev/null
+++ b/doc/developer-guide/api/functions/TSVConnFdGet.en.rst
@@ -0,0 +1,34 @@
+.. Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed
+   with this work for additional information regarding copyright
+   ownership.  The ASF licenses this file to you under the Apache
+   License, Version 2.0 (the "License"); you may not use this file
+   except in compliance with the License.  You may obtain a copy of
+   the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied.  See the License for the specific language governing
+   permissions and limitations under the License.
+
+
+TSVConnFdGet
+
+
+Synopsis
+
+
+.. code-block:: cpp
+
+#include 
+
+.. c:function:: int TSVConnFdGet(TSVConn vconnp)
+
+
+Description
+---
+Returns the file descriptor associated with the network connection :arg:`sslp`.
+It returns -1 on error.
diff --git a/include/ts/ts.h b/include/ts/ts.h
index 226b3c6f1e..6b39abf925 100644
--- a/include/ts/ts.h
+++ b/include/ts/ts.h
@@ -1219,6 +1219,8 @@ tsapi void TSVConnReenable(TSVConn sslvcp);
 tsapi TSReturnCode TSVConnTunnel(TSVConn sslp);
 /*  Return the SSL object associated with the connection */
 tsapi TSSslConnection TSVConnSSLConnectionGet(TSVConn sslp);
+/* Return the file descriptoer associated with the connection */
+tsapi int TSVConnFdGet(TSVConn sslp);
 /*  Fetch a SSL context from the global lookup table */
 tsapi TSSslContext TSSslContextFindByName(const char *name);
 tsapi TSSslContext TSSslContextFindByAddr(struct sockaddr const *);
diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc
index 56d135107d..4c7a221a82 100644
--- a/src/traffic_server/InkAPI.cc
+++ b/src/traffic_server/InkAPI.cc
@@ -9199,6 +9199,14 @@ TSVConnSSLConnectionGet(TSVConn sslp)
   return ssl;
 }
 
+tsapi int
+SVConnFdGet(TSVConn vconnp)
+{
+  sdk_assert(sdk_sanity_check_null_ptr(vconnp) == TS_SUCCESS);
+  NetVConnection *vc = reinterpret_cast(vconnp);
+  return vc->get_socket();
+}
+
 tsapi TSSslContext
 TSSslContextFindByName(const char *name)
 {



[trafficserver] branch master updated: CID-1508851: Possible "fix" for a false positive issue from coverity. (#10544)

2023-10-06 Thread dmeden
This is an automated email from the ASF dual-hosted git repository.

dmeden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new 26a9de0376 CID-1508851: Possible "fix" for a false positive issue from 
coverity. (#10544)
26a9de0376 is described below

commit 26a9de03762752f99da664a72110cc7f8fa74c6d
Author: Damian Meden 
AuthorDate: Fri Oct 6 17:18:51 2023 +0200

CID-1508851: Possible "fix" for a false positive issue from coverity. 
(#10544)
---
 mgmt/rpc/server/IPCSocketServer.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mgmt/rpc/server/IPCSocketServer.cc 
b/mgmt/rpc/server/IPCSocketServer.cc
index 05a07cfc16..aeb4c89825 100644
--- a/mgmt/rpc/server/IPCSocketServer.cc
+++ b/mgmt/rpc/server/IPCSocketServer.cc
@@ -218,7 +218,7 @@ IPCSocketServer::run()
 }
 
 std::error_code ec;
-if (auto fd = this->accept(ec); !ec) {
+if (int fd = this->accept(ec); !ec) {
   Client client{fd};
 
   if (auto [ok, errStr] = client.read_all(bw); ok) {
@@ -270,7 +270,7 @@ IPCSocketServer::create_socket(std::error_code )
 int
 IPCSocketServer::accept(std::error_code ) const
 {
-  int ret = {-1};
+  int ret{-1};
 
   for (int retries = 0; retries < _conf.maxRetriesOnTransientErrors; 
retries++) {
 ret = ::accept(_socket, 0, 0);