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

Allow setting TCP_NODELAY socket option in Classic Server

and make if default true on both arhitecture.
This commit is contained in:
kkuznetsov 2005-04-04 12:54:34 +00:00
parent 0f0c3e1e8a
commit 438005440f
3 changed files with 23 additions and 7 deletions

View File

@ -341,8 +341,7 @@
# Either enables or disables Nagle algorithm (TCP_NODELAY option of
# socket) of the socket connection.
#
# Note: Currently this is only active for super server, classic
# server needs an extra wrapper program.
# Note: Currently is a default for classic and super servers.
#
# Type: boolean
#

View File

@ -65,7 +65,7 @@ const ConfigImpl::ConfigEntry ConfigImpl::entries[] =
{TYPE_INTEGER, "CpuAffinityMask", (ConfigValue) 1},
{TYPE_BOOLEAN, "OldParameterOrdering", (ConfigValue) false},
{TYPE_INTEGER, "TcpRemoteBufferSize", (ConfigValue) 8192}, // bytes
{TYPE_BOOLEAN, "TcpNoNagle", (ConfigValue) false},
{TYPE_BOOLEAN, "TcpNoNagle", (ConfigValue) true},
#ifdef SUPERSERVER
{TYPE_INTEGER, "DefaultDbCachePages", (ConfigValue) 2048}, // pages
#else

View File

@ -38,6 +38,7 @@
*
* 2002.10.30 Sean Leyne - Removed support for obsolete "PC_PLATFORM" define
* 2002.10.30 Sean Leyne - Code Cleanup, removed obsolete "SUN3_3" port
* 2005.04.01 Konstantin Kuznetsov - allow setting NoNagle option in Classic
*
*/
@ -75,14 +76,14 @@
#include <unistd.h>
#endif
#include <netinet/tcp.h>
#ifdef SUPERSERVER
#ifdef WIN_NT
#define FD_SETSIZE 1024
#endif
#ifdef SET_TCP_NO_DELAY
#include <netinet/tcp.h>
#endif
#endif /* SUPERSERVER */
@ -1024,6 +1025,7 @@ rem_port* INET_server(int sock)
* established. Set up port block with the appropriate socket.
*
**************************************/
int n = 0;
#ifdef VMS
ISC_tcp_setup(ISC_wait, gds__completion_ast);
#endif
@ -1032,8 +1034,23 @@ rem_port* INET_server(int sock)
port->port_handle = (HANDLE) sock;
int optval = 1;
setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
n = setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
(SCHAR *) & optval, sizeof(optval));
if (n==-1) {
gds__log("inet server err: setting KEEPALIVE socket option \n");
}
if (Config::getTcpNoNagle()) {
n = setsockopt(sock, SOL_SOCKET,TCP_NODELAY,
(SCHAR *) &optval, sizeof(optval));
#ifdef DEBUG
gds__log("inet log: disabled Nagle algorithm \n");
#endif
if (n == -1) {
gds__log("inet server err: setting NODELAY socket option \n");
}
}
return port;
}