Skip to content

Commit

Permalink
Remove loopback fastpath - Fix #1480 (#1508)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone authored Sep 18, 2023
1 parent e1cb50c commit 24e6ac1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 67 deletions.
40 changes: 0 additions & 40 deletions cpp/src/Ice/Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down
27 changes: 0 additions & 27 deletions csharp/src/Ice/Network.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 24e6ac1

Please sign in to comment.