Hard limits moved to limits.h

Limits used with SO_[RCV|SEND]BUF moved from gw.h to limits.h and
renamed so that the prefix is MXS_.
This commit is contained in:
Johan Wikman 2016-10-17 09:58:45 +03:00
parent 4faa7f8d21
commit 8aafa34d66
4 changed files with 46 additions and 18 deletions

View File

@ -41,15 +41,6 @@ MXS_BEGIN_DECLS
// network buffer is 32K
#define MAX_BUFFER_SIZE 32768
/**
* Configuration for send and receive socket buffer sizes for
* backend and cleint connections.
*/
#define GW_BACKEND_SO_SNDBUF (128 * 1024)
#define GW_BACKEND_SO_RCVBUF (128 * 1024)
#define GW_CLIENT_SO_SNDBUF (128 * 1024)
#define GW_CLIENT_SO_RCVBUF (128 * 1024)
#define GW_NOINTR_CALL(A) do { errno = 0; A; } while (errno == EINTR)
bool gw_daemonize(void);

View File

@ -18,12 +18,49 @@
MXS_BEGIN_DECLS
// This file defines hard limits of MaxScale.
/**
* @file lmits.h
*
* This file contains defines for hard limits of MaxScale.
*/
// Thread information is stored in a bitmask whose size must be a
// multiple of 8. The bitmask is indexed using the thread id that start
// from 1. Hence, the hard maximum number of threads must be a
// multiple of 8 minus 1.
/**
* MXS_BACKEND_SO_RCVBUF
*
* The value used when setting SO_RCVBUF of backend sockets.
*/
#define MXS_BACKEND_SO_RCVBUF (128 * 1024)
/**
* MSX_BACKEND_SO_SNDBUF
*
* The value used when setting SO_SNDBUF of backend sockets.
*/
#define MXS_BACKEND_SO_SNDBUF (128 * 1024)
/**
* MXS_CLIENT_SO_RCVBUF
*
* The value used when setting SO_RCVBUF of client sockets.
*/
#define MXS_CLIENT_SO_RCVBUF (128 * 1024)
/**
* MXS_CLIENT_SO_SNDBUF
*
* The value used when setting SO_SNDBUF of client sockets.
*/
#define MXS_CLIENT_SO_SNDBUF (128 * 1024)
/**
* MXS_MAX_THREADS
*
* Thread information is stored in a bitmask whose size must be a
* multiple of 8. The bitmask is indexed using the thread id that start
* from 1. Hence, the hard maximum number of threads must be a
* multiple of 8 minus 1.
*/
#define MXS_MAX_THREADS 255
MXS_END_DECLS

View File

@ -3101,7 +3101,7 @@ dcb_accept(DCB *listener, GWPROTOCOL *protocol_funcs)
conn_open[c_sock] = true;
#endif /* FAKE_CODE */
/* set nonblocking */
sendbuf = GW_CLIENT_SO_SNDBUF;
sendbuf = MXS_CLIENT_SO_SNDBUF;
if (setsockopt(c_sock, SOL_SOCKET, SO_SNDBUF, &sendbuf, optlen) != 0)
{
@ -3109,7 +3109,7 @@ dcb_accept(DCB *listener, GWPROTOCOL *protocol_funcs)
errno, strerror_r(errno, errbuf, sizeof(errbuf)));
}
sendbuf = GW_CLIENT_SO_RCVBUF;
sendbuf = MXS_CLIENT_SO_RCVBUF;
if (setsockopt(c_sock, SOL_SOCKET, SO_RCVBUF, &sendbuf, optlen) != 0)
{

View File

@ -323,7 +323,7 @@ gw_do_connect_to_backend(char *host, int port, int *fd)
/* prepare for connect */
setipaddress(&serv_addr.sin_addr, host);
serv_addr.sin_port = htons(port);
bufsize = GW_BACKEND_SO_SNDBUF;
bufsize = MXS_BACKEND_SO_SNDBUF;
if (setsockopt(so, SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof(bufsize)) != 0)
{
@ -340,7 +340,7 @@ gw_do_connect_to_backend(char *host, int port, int *fd)
close_socket(so);
goto return_rv;
}
bufsize = GW_BACKEND_SO_RCVBUF;
bufsize = MXS_BACKEND_SO_RCVBUF;
if (setsockopt(so, SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof(bufsize)) != 0)
{