You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2018/03/29 10:53:27 UTC
[geode-native] branch feature/GEODE-4946-msvc-warn updated: Removes
system sepecific socketopts
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
The following commit(s) were added to refs/heads/feature/GEODE-4946-msvc-warn by this push:
new 8e5e4e9 Removes system sepecific socketopts
8e5e4e9 is described below
commit 8e5e4e941bf6d55b32e8763657e13060a8afbf6a
Author: Jacob Barrett <jb...@pivotal.io>
AuthorDate: Thu Mar 29 10:53:13 2018 +0000
Removes system sepecific socketopts
---
tests/cpp/fwklib/TcpIpc.cpp | 29 +++++++----------------------
1 file changed, 7 insertions(+), 22 deletions(-)
diff --git a/tests/cpp/fwklib/TcpIpc.cpp b/tests/cpp/fwklib/TcpIpc.cpp
index 22af7ae..68d5fc8 100644
--- a/tests/cpp/fwklib/TcpIpc.cpp
+++ b/tests/cpp/fwklib/TcpIpc.cpp
@@ -35,12 +35,8 @@ using namespace apache::geode::client::testframework;
void TcpIpc::clearNagle(ACE_HANDLE sock) {
int32_t val = 1;
-#ifdef WIN32
- const char *param = (const char *)&val;
-#else
- const void *param = (const void *)&val;
-#endif
- int32_t plen = sizeof(param);
+ char *param = (char *)&val;
+ int32_t plen = sizeof(val);
if (0 != ACE_OS::setsockopt(sock, IPPROTO_TCP, 1, param, plen)) {
FWKSEVERE("Failed to set NAGLE on socket. Errno: " << errno);
@@ -49,12 +45,8 @@ void TcpIpc::clearNagle(ACE_HANDLE sock) {
int32_t TcpIpc::getSize(ACE_HANDLE sock, int32_t flag) {
int32_t val = 0;
-#ifdef _WIN32
- char *param = (char *)&val;
-#else
- void *param = (void *)&val;
-#endif
- socklen_t plen = sizeof(val);
+ auto *param = reinterpret_cast<char *>(&val);
+ int32_t plen = sizeof(val);
if (0 != ACE_OS::getsockopt(sock, SOL_SOCKET, flag, param, &plen)) {
FWKSEVERE("Failed to get buff size for flag "
@@ -70,15 +62,8 @@ int32_t TcpIpc::setSize(ACE_HANDLE sock, int32_t flag, int32_t size) {
int32_t val = 0;
if (size <= 0) return 0;
-#ifdef _WIN32
- const char *cparam = (const char *)&val;
- char *param = (char *)&val;
-#else
- const void *cparam = (const void *)&val;
- void *param = (void *)&val;
-#endif
- socklen_t plen = sizeof(val);
- socklen_t clen = sizeof(val);
+ auto *param = reinterpret_cast<char *>(&val);
+ int32_t plen = sizeof(val);
int32_t inc = 32120;
val = size - (3 * inc);
@@ -88,7 +73,7 @@ int32_t TcpIpc::setSize(ACE_HANDLE sock, int32_t flag, int32_t size) {
while (lastRed != red) {
lastRed = red;
val += inc;
- ACE_OS::setsockopt(sock, SOL_SOCKET, flag, cparam, clen);
+ ACE_OS::setsockopt(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);
--
To stop receiving notification emails like this one, please contact
jbarrett@apache.org.