This is an automated email from the ASF dual-hosted git repository.

shinrich pushed a commit to branch add-ssl-apis
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit a306a2e646b00e26df82966ee738e7cbe7daa652
Author: Susan Hinrichs <[email protected]>
AuthorDate: Wed Sep 6 20:01:10 2023 +0000

    Generalize the FdGet() call
---
 .../{TSVConnSslFdGet.en.rst => TSVConnFdGet.en.rst}      |  8 ++++----
 include/ts/ts.h                                          |  2 +-
 src/traffic_server/InkAPI.cc                             | 16 ++++++----------
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/doc/developer-guide/api/functions/TSVConnSslFdGet.en.rst 
b/doc/developer-guide/api/functions/TSVConnFdGet.en.rst
similarity index 85%
rename from doc/developer-guide/api/functions/TSVConnSslFdGet.en.rst
rename to doc/developer-guide/api/functions/TSVConnFdGet.en.rst
index dec2779427..7e5a808115 100644
--- a/doc/developer-guide/api/functions/TSVConnSslFdGet.en.rst
+++ b/doc/developer-guide/api/functions/TSVConnFdGet.en.rst
@@ -15,8 +15,8 @@
    permissions and limitations under the License.
 
 
-TSVConnSslFdGet
-===============
+TSVConnFdGet
+============
 
 Synopsis
 --------
@@ -25,10 +25,10 @@ Synopsis
 
     #include <ts/ts.h>
 
-.. c:function:: int TSVConnSslFdGet(TSVConn sslp)
+.. c:function:: int TSVConnFdGet(TSVConn vconnp)
 
 
 Description
 -----------
-Returns the file descriptor associated with the SSL connection :arg:`sslp`.
+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 94312d041d..9c3ab8e2fd 100644
--- a/include/ts/ts.h
+++ b/include/ts/ts.h
@@ -1316,7 +1316,7 @@ namespace c
   /*  Return the SSL object associated with the connection */
   TSSslConnection TSVConnSslConnectionGet(TSVConn sslp);
   /* Return the file descriptoer associated with the ssl connection */
-  int TSVConnSslFdGet(TSVConn sslp);
+  int TSVConnFdGet(TSVConn sslp);
   /* Return the intermediate X509StoreCTX object that references the 
certificate being validated */
   TSSslVerifyCTX TSVConnSslVerifyCTXGet(TSVConn sslp);
   /*  Fetch a SSL context from the global lookup table */
diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc
index f5575e48c6..c1421b8ae8 100644
--- a/src/traffic_server/InkAPI.cc
+++ b/src/traffic_server/InkAPI.cc
@@ -9133,17 +9133,13 @@ tsapi::c::TSVConnSslConnectionGet(TSVConn sslp)
 }
 
 int
-tsapi::c::TSVConnSslFdGet(TSVConn sslp)
-{
-  TSSslConnection sslvc = TSVConnSslConnectionGet(sslp);
-  int fd                = -1;
-  if (sslvc != nullptr) {
-    SSL *sslObj = reinterpret_cast<SSL *>(sslvc);
-    if (sslObj != nullptr) {
-      fd = SSL_get_wfd(sslObj);
-    }
+tsapi::c::TSVConnFdGet(TSVConn vconnp)
+{
+  NetVConnection *vc = reinterpret_cast<NetVConnection *>(vconnp);
+  if (vc != nullptr) {
+    return vc->get_socket();
   }
-  return fd;
+  return -1;
 }
 
 const char *

Reply via email to