8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:03:03 +01:00

CORE-6004: Add a switch to disable the "TCP Loopback Fast Path" option (Windows only)

This commit is contained in:
KarloX2 2019-02-19 17:22:11 +01:00
parent d31495be14
commit 540c90546f
5 changed files with 28 additions and 7 deletions

View File

@ -768,6 +768,14 @@
#
#TcpNoNagle = 1
#
# Either enables or disables the "TCP Loopback Fast Path" feature (SIO_LOOPBACK_FAST_PATH).
# Applies to Windows (version 8/2012 or higher) only.
#
# Type: Boolean, default 1 (true)
#
#TcpLoopbackFastPathOption = 1
#
# Allows setting of IPV6_V6ONLY socket option. If enabled, IPv6 sockets
# allow only IPv6 communication and separate sockets must be used for

View File

@ -124,6 +124,7 @@ Only meaningful for Windows SS on SMP systems.
OldParameterOrdering boolean default false
TcpRemoteBufferSize integer default 8192 (bytes)
TcpNoNagle boolean default false
TcpLoopbackFastPathOption boolean default true
IpcMapSize integer default 4096 (bytes)
DefaultDbCachePages integer default SS: 2048. CS: 75
ConnectionTimeout integer default 180 (seconds)

View File

@ -148,6 +148,7 @@ const Config::ConfigEntry Config::entries[MAX_CONFIG_KEY] =
{TYPE_INTEGER, "CpuAffinityMask", (ConfigValue) 0},
{TYPE_INTEGER, "TcpRemoteBufferSize", (ConfigValue) 8192}, // bytes
{TYPE_BOOLEAN, "TcpNoNagle", (ConfigValue) true},
{TYPE_BOOLEAN, "TcpLoopbackFastPathOption",(ConfigValue) true},
{TYPE_INTEGER, "DefaultDbCachePages", (ConfigValue) -1}, // pages
{TYPE_INTEGER, "ConnectionTimeout", (ConfigValue) 180}, // seconds
{TYPE_INTEGER, "DummyPacketInterval", (ConfigValue) 0}, // seconds
@ -492,6 +493,11 @@ bool Config::getTcpNoNagle() const
return get<bool>(KEY_TCP_NO_NAGLE);
}
bool Config::getTcpLoopbackFastPathOption() const
{
return get<bool>(KEY_TCP_LOOPBACK_FAST_PATH_OPTION);
}
bool Config::getIPv6V6Only() const
{
return get<bool>(KEY_IPV6_V6ONLY);

View File

@ -95,6 +95,7 @@ public:
KEY_CPU_AFFINITY_MASK,
KEY_TCP_REMOTE_BUFFER_SIZE,
KEY_TCP_NO_NAGLE,
KEY_TCP_LOOPBACK_FAST_PATH_OPTION,
KEY_DEFAULT_DB_CACHE_PAGES,
KEY_CONNECTION_TIMEOUT,
KEY_DUMMY_PACKET_INTERVAL,
@ -252,6 +253,9 @@ public:
// Disable Nagle algorithm
bool getTcpNoNagle() const;
// Enable or disable the TCP Loopback Fast Path option
bool getTcpLoopbackFastPathOption() const;
// Let IPv6 socket accept only IPv6 packets
bool getIPv6V6Only() const;

View File

@ -3242,16 +3242,18 @@ static bool setNoNagleOption(rem_port* port)
bool setFastLoopbackOption(SOCKET s)
{
#ifdef WIN_NT
int optval = 1;
DWORD bytes = 0;
if (Config::getDefaultConfig()->getTcpLoopbackFastPathOption())
{
int optval = 1;
DWORD bytes = 0;
int ret = WSAIoctl(s, SIO_LOOPBACK_FAST_PATH, &optval, sizeof(optval),
NULL, 0, &bytes, 0, 0);
int ret = WSAIoctl(s, SIO_LOOPBACK_FAST_PATH, &optval, sizeof(optval),
NULL, 0, &bytes, 0, 0);
return (ret == 0);
#else
return false;
return (ret == 0);
}
#endif
return false;
}
void setStopMainThread(FPTR_INT func)