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

bbender pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new 4ccd5f7  GEODE-9551: Fixes API return and parameter types. (#860)
4ccd5f7 is described below

commit 4ccd5f7d5f37728b83798b4ec2b5e7532bafc7b0
Author: Jacob Barrett <[email protected]>
AuthorDate: Fri Aug 27 12:13:18 2021 -0700

    GEODE-9551: Fixes API return and parameter types. (#860)
---
 cppcache/include/geode/Pool.hpp        | 8 ++------
 cppcache/include/geode/PoolFactory.hpp | 2 +-
 cppcache/src/Pool.cpp                  | 7 +++++--
 cppcache/src/PoolAttributes.hpp        | 8 ++++----
 cppcache/src/PoolFactory.cpp           | 5 ++---
 cppcache/src/TcrConnection.cpp         | 4 ++--
 cppcache/src/ThinClientPoolDM.hpp      | 2 --
 7 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/cppcache/include/geode/Pool.hpp b/cppcache/include/geode/Pool.hpp
index 5c82c29..f4abcd5 100644
--- a/cppcache/include/geode/Pool.hpp
+++ b/cppcache/include/geode/Pool.hpp
@@ -31,10 +31,6 @@
 #include "internal/geode_base.hpp"
 #include "internal/geode_globals.hpp"
 
-/**
- * @file
- */
-
 namespace apache {
 namespace geode {
 namespace client {
@@ -98,13 +94,13 @@ class APACHE_GEODE_EXPORT Pool : public 
std::enable_shared_from_this<Pool> {
    * Gets the host name of the SniProxy.
    * @see PoolFactory#setSniProxy(string, int)
    */
-  std::string getSniProxyHost() const;
+  const std::string& getSniProxyHost() const;
 
   /**
    * Gets the port of the SniProxy.
    * @see PoolFactory#setSniProxy(string, int)
    */
-  int getSniProxyPort() const;
+  uint16_t getSniProxyPort() const;
 
   /**
    * Gets the minimum connections for this pool.
diff --git a/cppcache/include/geode/PoolFactory.hpp 
b/cppcache/include/geode/PoolFactory.hpp
index d554482..7dc52b2 100644
--- a/cppcache/include/geode/PoolFactory.hpp
+++ b/cppcache/include/geode/PoolFactory.hpp
@@ -429,7 +429,7 @@ class APACHE_GEODE_EXPORT PoolFactory {
   /**
    * Set proxy info for SNI connection.  Used for connecting via SNI proxy.
    */
-  PoolFactory& setSniProxy(const std::string& hostname, const int port);
+  PoolFactory& setSniProxy(std::string hostname, uint16_t port);
 
   /**
    * If set to <code>true</code> then the created pool will have
diff --git a/cppcache/src/Pool.cpp b/cppcache/src/Pool.cpp
index 795cc23..4fbf5e0 100644
--- a/cppcache/src/Pool.cpp
+++ b/cppcache/src/Pool.cpp
@@ -46,8 +46,11 @@ std::chrono::milliseconds Pool::getReadTimeout() const {
   return m_attrs->getReadTimeout();
 }
 
-std::string Pool::getSniProxyHost() const { return m_attrs->getSniProxyHost(); 
}
-int Pool::getSniProxyPort() const { return m_attrs->getSniProxyPort(); }
+const std::string& Pool::getSniProxyHost() const {
+  return m_attrs->getSniProxyHost();
+}
+
+uint16_t Pool::getSniProxyPort() const { return m_attrs->getSniProxyPort(); }
 
 int Pool::getMinConnections() const { return m_attrs->getMinConnections(); }
 
diff --git a/cppcache/src/PoolAttributes.hpp b/cppcache/src/PoolAttributes.hpp
index 44d9633..5af3b26 100644
--- a/cppcache/src/PoolAttributes.hpp
+++ b/cppcache/src/PoolAttributes.hpp
@@ -123,11 +123,11 @@ class PoolAttributes {
 
   const std::string& getSniProxyHost() const { return m_sniProxyHost; }
 
-  void setSniProxyHost(const std::string& host) { m_sniProxyHost = host; }
+  void setSniProxyHost(std::string host) { m_sniProxyHost = std::move(host); }
 
-  int getSniProxyPort() const { return m_sniProxyPort; }
+  uint16_t getSniProxyPort() const { return m_sniProxyPort; }
 
-  void setSniProxyPort(const int port) { m_sniProxyPort = port; }
+  void setSniProxyPort(const uint16_t port) { m_sniProxyPort = port; }
 
   const std::string& getServerGroup() const { return m_serverGrp; }
 
@@ -203,7 +203,7 @@ class PoolAttributes {
   std::vector<std::string> m_initServList;
 
   std::string m_sniProxyHost;
-  int m_sniProxyPort;
+  uint16_t m_sniProxyPort;
 
   static bool compareVectorOfStrings(
       const std::vector<std::string>& thisVector,
diff --git a/cppcache/src/PoolFactory.cpp b/cppcache/src/PoolFactory.cpp
index 465a1fc..e769d1b 100644
--- a/cppcache/src/PoolFactory.cpp
+++ b/cppcache/src/PoolFactory.cpp
@@ -183,9 +183,8 @@ PoolFactory& PoolFactory::addServer(const std::string& 
host, int port) {
   return *this;
 }
 
-PoolFactory& PoolFactory::setSniProxy(const std::string& hostname,
-                                      const int port) {
-  m_attrs->setSniProxyHost(hostname);
+PoolFactory& PoolFactory::setSniProxy(std::string hostname, uint16_t port) {
+  m_attrs->setSniProxyHost(std::move(hostname));
   m_attrs->setSniProxyPort(port);
   return *this;
 }
diff --git a/cppcache/src/TcrConnection.cpp b/cppcache/src/TcrConnection.cpp
index 8cc88bf..7ed0a91 100644
--- a/cppcache/src/TcrConnection.cpp
+++ b/cppcache/src/TcrConnection.cpp
@@ -470,14 +470,14 @@ void TcrConnection::createConnection(const std::string& 
address,
                                .getSystemProperties();
 
   if (systemProperties.sslEnabled()) {
-    auto sniHostname = m_poolDM->getSNIProxyHostname();
-    auto sniPort = m_poolDM->getSNIPort();
+    const auto& sniHostname = m_poolDM->getSniProxyHost();
     if (sniHostname.empty()) {
       m_conn.reset(new TcpSslConn(address, connectTimeout, maxBuffSizePool,
                                   systemProperties.sslTrustStore(),
                                   systemProperties.sslKeyStore(),
                                   systemProperties.sslKeystorePassword()));
     } else {
+      const auto sniPort = m_poolDM->getSniProxyPort();
       m_conn.reset(new TcpSslConn(
           address, connectTimeout, maxBuffSizePool, sniHostname, sniPort,
           systemProperties.sslTrustStore(), systemProperties.sslKeyStore(),
diff --git a/cppcache/src/ThinClientPoolDM.hpp 
b/cppcache/src/ThinClientPoolDM.hpp
index e306dff..3e03b8a 100644
--- a/cppcache/src/ThinClientPoolDM.hpp
+++ b/cppcache/src/ThinClientPoolDM.hpp
@@ -173,8 +173,6 @@ class ThinClientPoolDM
   GfErrType getConnectionToAnEndPoint(std::string epNameStr,
                                       TcrConnection*& conn);
 
-  const std::string getSNIProxyHostname() { return m_attrs->getSniProxyHost(); 
}
-  uint16_t getSNIPort() { return m_attrs->getSniProxyPort(); }
   virtual inline bool isSticky() { return m_sticky; }
   virtual TcrEndpoint* getEndPoint(
       const std::shared_ptr<BucketServerLocation>& serverLocation,

Reply via email to