diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2014-08-15 09:39:40 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2014-08-15 09:39:40 -0230 |
commit | 668532f2fa2b345f6d1b88df9dcfcd1f87ee255d (patch) | |
tree | 215447f0cb7da905732d0d529d854ecae53c1877 /cpp/src/Ice/Network.cpp | |
parent | Fixed ICE-5621: set _WIN32_WINNT when building (diff) | |
download | ice-668532f2fa2b345f6d1b88df9dcfcd1f87ee255d.tar.bz2 ice-668532f2fa2b345f6d1b88df9dcfcd1f87ee255d.tar.xz ice-668532f2fa2b345f6d1b88df9dcfcd1f87ee255d.zip |
Fixed fast path setting to not rely on hardcoded value
Diffstat (limited to 'cpp/src/Ice/Network.cpp')
-rw-r--r-- | cpp/src/Ice/Network.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index c94df47eb75..10ed510453a 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -61,7 +61,7 @@ extern "C" #endif #if defined(_WIN32) && !defined(ICE_OS_WINRT) -# define HAS_LOOPBACK_FAST_PATH 1 +# include <mstcpip.h> #endif using namespace std; @@ -148,20 +148,17 @@ setKeepAlive(SOCKET fd) } #endif -#ifdef HAS_LOOPBACK_FAST_PATH +#if defined(_WIN32) && !defined(ICE_OS_WINRT) void setTcpLoopbackFastPath(SOCKET fd) { - // We define SIO_LOOPBACK_FAST_PATH ourselves rather than get it from mstcpip.h since - // code needs to compile on platforms that do not support this feature. On those platforms - // the WSAIoctl call will just return WSAEOPNOTSUPP. - const int SIO_LOOPBACK_FAST_PATH = (-1744830448); int OptionValue = 1; DWORD NumberOfBytesReturned = 0; int status = WSAIoctl(fd, SIO_LOOPBACK_FAST_PATH, &OptionValue, sizeof(OptionValue), NULL, 0, &NumberOfBytesReturned, 0, 0); if(status == SOCKET_ERROR) { + // On platforms that do not support fast path (< Windows 8), WSAEONOTSUPP is expected. DWORD LastError = ::GetLastError(); if(LastError != WSAEOPNOTSUPP) { @@ -220,7 +217,7 @@ createSocketImpl(bool udp, int family) { setTcpNoDelay(fd); setKeepAlive(fd); -#ifdef HAS_LOOPBACK_FAST_PATH +#if defined(_WIN32) && !defined(ICE_OS_WINRT) setTcpLoopbackFastPath(fd); #endif } |