geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbarr...@apache.org
Subject [geode-native] 02/02: Fixes socket type warning.
Date Thu, 29 Mar 2018 10:42:30 GMT
This is an automated email from the ASF dual-hosted git repository.

jbarrett pushed a commit to branch feature/GEODE-4946-msvc-warn
in repository https://gitbox.apache.org/repos/asf/geode-native.git

commit 5583e3ad8d3e3f9651eee2fc062d14ffc8e59cd5
Author: Jacob Barrett <jbarrett@pivotal.io>
AuthorDate: Thu Mar 29 10:41:56 2018 +0000

    Fixes socket type warning.
---
 tests/cpp/fwklib/TcpIpc.cpp | 18 +++++++++---------
 tests/cpp/fwklib/TcpIpc.hpp |  6 +++---
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tests/cpp/fwklib/TcpIpc.cpp b/tests/cpp/fwklib/TcpIpc.cpp
index 2dab7cb..22af7ae 100644
--- a/tests/cpp/fwklib/TcpIpc.cpp
+++ b/tests/cpp/fwklib/TcpIpc.cpp
@@ -33,7 +33,7 @@
 using namespace apache::geode::client;
 using namespace apache::geode::client::testframework;
 
-void TcpIpc::clearNagle(int32_t sock) {
+void TcpIpc::clearNagle(ACE_HANDLE sock) {
   int32_t val = 1;
 #ifdef WIN32
   const char *param = (const char *)&val;
@@ -42,12 +42,12 @@ void TcpIpc::clearNagle(int32_t sock) {
 #endif
   int32_t plen = sizeof(param);
 
-  if (0 != setsockopt(sock, IPPROTO_TCP, 1, param, plen)) {
+  if (0 != ACE_OS::setsockopt(sock, IPPROTO_TCP, 1, param, plen)) {
     FWKSEVERE("Failed to set NAGLE on socket.  Errno: " << errno);
   }
 }
 
-int32_t TcpIpc::getSize(int32_t sock, int32_t flag) {
+int32_t TcpIpc::getSize(ACE_HANDLE sock, int32_t flag) {
   int32_t val = 0;
 #ifdef _WIN32
   char *param = (char *)&val;
@@ -56,7 +56,7 @@ int32_t TcpIpc::getSize(int32_t sock, int32_t flag) {
 #endif
   socklen_t plen = sizeof(val);
 
-  if (0 != getsockopt(sock, SOL_SOCKET, flag, param, &plen)) {
+  if (0 != ACE_OS::getsockopt(sock, SOL_SOCKET, flag, param, &plen)) {
     FWKSEVERE("Failed to get buff size for flag "
               << flag << " on socket.  Errno: " << errno);
   }
@@ -66,7 +66,7 @@ int32_t TcpIpc::getSize(int32_t sock, int32_t flag) {
   return val;
 }
 
-int32_t TcpIpc::setSize(int32_t sock, int32_t flag, int32_t size) {
+int32_t TcpIpc::setSize(ACE_HANDLE sock, int32_t flag, int32_t size) {
   int32_t val = 0;
   if (size <= 0) return 0;
 
@@ -88,8 +88,8 @@ int32_t TcpIpc::setSize(int32_t sock, int32_t flag, int32_t size) {
   while (lastRed != red) {
     lastRed = red;
     val += inc;
-    setsockopt(sock, SOL_SOCKET, flag, cparam, clen);
-    if (0 != getsockopt(sock, SOL_SOCKET, flag, param, &plen)) {
+    ACE_OS::setsockopt(sock, SOL_SOCKET, flag, cparam, clen);
+    if (0 != ACE_OS::getsockopt(sock, SOL_SOCKET, flag, param, &plen)) {
       FWKSEVERE("Failed to get buff size for flag "
                 << flag << " on socket.  Errno: " << errno);
     }
@@ -102,7 +102,7 @@ int32_t TcpIpc::setSize(int32_t sock, int32_t flag, int32_t size) {
 }
 
 void TcpIpc::init(int32_t sockBufferSize) {
-  int32_t sock = (int32_t)socket(AF_INET, SOCK_STREAM, 0);
+  auto sock = ACE_OS::socket(AF_INET, SOCK_STREAM, 0);
   if (sock < 0) {
     FWKSEVERE("Failed to create socket.  Errno: " << errno);
   }
@@ -116,7 +116,7 @@ void TcpIpc::init(int32_t sockBufferSize) {
     int32_t size = getSize(sock, SO_SNDBUF);
     size = getSize(sock, SO_RCVBUF);
   }
-  m_io = new ACE_SOCK_Stream((ACE_HANDLE)sock);
+  m_io = new ACE_SOCK_Stream(sock);
   ACE_OS::signal(SIGPIPE, SIG_IGN);  // Ignore broken pipe
 }
 
diff --git a/tests/cpp/fwklib/TcpIpc.hpp b/tests/cpp/fwklib/TcpIpc.hpp
index c4e20f0..d5f2ada 100644
--- a/tests/cpp/fwklib/TcpIpc.hpp
+++ b/tests/cpp/fwklib/TcpIpc.hpp
@@ -37,9 +37,9 @@ class TcpIpc {
   std::string m_ipaddr;
 
   void init(int32_t sockBufferSize = 0);
-  void clearNagle(int32_t sock);
-  int32_t setSize(int32_t sock, int32_t flag, int32_t size);
-  int32_t getSize(int32_t sock, int32_t flag);
+  void clearNagle(ACE_HANDLE sock);
+  int32_t setSize(ACE_HANDLE sock, int32_t flag, int32_t size);
+  int32_t getSize(ACE_HANDLE sock, int32_t flag);
 
  public:
   TcpIpc(std::string& ipaddr, int32_t sockBufferSize = 0) : m_ipaddr(ipaddr) {

-- 
To stop receiving notification emails like this one, please contact
jbarrett@apache.org.

Mime
View raw message