From 24e6ac1659defa5cd8c60edde0392b3685f460a2 Mon Sep 17 00:00:00 2001 From: Jose Date: Mon, 18 Sep 2023 17:07:45 +0200 Subject: [PATCH] Remove loopback fastpath - Fix #1480 (#1508) --- cpp/src/Ice/Network.cpp | 40 --------------------------------------- csharp/src/Ice/Network.cs | 27 -------------------------- 2 files changed, 67 deletions(-) diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index 4e42cafc811..ccf78cc66bd 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -54,12 +54,6 @@ # pragma GCC diagnostic ignored "-Wmissing-field-initializers" #endif -#if defined(_WIN32) -# ifndef SIO_LOOPBACK_FAST_PATH -# define SIO_LOOPBACK_FAST_PATH _WSAIOW(IOC_VENDOR,16) -# endif -#endif - #if defined(__MINGW32__) // // Work-around for missing definitions in MinGW Windows headers @@ -182,28 +176,6 @@ setKeepAlive(SOCKET fd) } } -#if defined(_WIN32) -void -setTcpLoopbackFastPath(SOCKET fd) -{ - int OptionValue = 1; - DWORD NumberOfBytesReturned = 0; - - int status = - WSAIoctl(fd, SIO_LOOPBACK_FAST_PATH, &OptionValue, sizeof(OptionValue), ICE_NULLPTR, 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) - { - closeSocketNoThrow(fd); - throw SocketException(__FILE__, __LINE__, getSocketErrno()); - } - } -} -#endif - SOCKET createSocketImpl(bool udp, int family) { @@ -226,18 +198,6 @@ createSocketImpl(bool udp, int family) { setTcpNoDelay(fd); setKeepAlive(fd); - -#if defined(_WIN32) - // - // FIX: the fast path loopback appears to cause issues with - // connection closure when it's enabled. Sometime, a peer - // doesn't receive the TCP/IP connection closure (RST) from - // the other peer and it ends up hanging. This is showing up - // with the background test when ran with WS. The test - // sporadically hangs on exit. See bug #6093. - // - //setTcpLoopbackFastPath(fd); -#endif } return fd; diff --git a/csharp/src/Ice/Network.cs b/csharp/src/Ice/Network.cs index dcd4f0e1c74..afceeae84db 100644 --- a/csharp/src/Ice/Network.cs +++ b/csharp/src/Ice/Network.cs @@ -237,13 +237,6 @@ public static Socket createSocket(bool udp, AddressFamily family) { setTcpNoDelay(socket); socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, 1); - // - // FIX: the fast path loopback appears to cause issues with - // connection closure when it's enabled. Sometime, a peer - // doesn't receive the TCP/IP connection closure (RST) from - // the other peer and it ends up hanging. See bug #6093. - // - //setTcpLoopbackFastPath(socket); } catch(SocketException ex) { @@ -318,26 +311,6 @@ public static void setTcpNoDelay(Socket socket) } } - // - // FIX: the fast path loopback appears to cause issues with - // connection closure when it's enabled. Sometime, a peer - // doesn't receive the TCP/IP connection closure (RST) from - // the other peer and it ends up hanging. See bug #6093. - // - // public static void setTcpLoopbackFastPath(Socket socket) - // { - // const int SIO_LOOPBACK_FAST_PATH = (-1744830448); - // byte[] OptionInValue = BitConverter.GetBytes(1); - // try - // { - // socket.IOControl(SIO_LOOPBACK_FAST_PATH, OptionInValue, null); - // } - // catch(Exception) - // { - // // Expected on platforms that do not support TCP Loopback Fast Path - // } - // } - public static void setBlock(Socket socket, bool block) { try