MXS-2312: Use default network buffer sizes

Removed the hard-coded network buffer sizes. This effectively makes them
configurable via the kernel.
This commit is contained in:
Markus Mäkelä
2019-03-20 10:22:57 +02:00
parent db97c3343d
commit e745d1cffb
3 changed files with 2 additions and 20 deletions

View File

@ -22,21 +22,6 @@
MXS_BEGIN_DECLS
/**
* MXS_SO_RCVBUF
*
* The size of the network input buffer.
*/
#define MXS_SO_RCVBUF_SIZE (128 * 1024)
/**
* MXS_SO_SNDBUF
*
* The size of the network output buffer.
*/
#define MXS_SO_SNDBUF_SIZE (128 * 1024)
/**
* MXS_MAX_THREADS
*

View File

@ -742,6 +742,7 @@ static int dcb_read_SSL(DCB* dcb, GWBUF** head)
*/
static GWBUF* dcb_basic_read_SSL(DCB* dcb, int* nsingleread)
{
const size_t MXS_SO_RCVBUF_SIZE = (128 * 1024);
unsigned char temp_buffer[MXS_SO_RCVBUF_SIZE];
GWBUF* buffer = NULL;

View File

@ -945,13 +945,9 @@ void utils_end()
bool configure_network_socket(int so, int type)
{
int sndbufsize = MXS_SO_SNDBUF_SIZE;
int rcvbufsize = MXS_SO_RCVBUF_SIZE;
int one = 1;
if (setsockopt(so, SOL_SOCKET, SO_SNDBUF, &sndbufsize, sizeof(sndbufsize)) != 0
|| setsockopt(so, SOL_SOCKET, SO_RCVBUF, &rcvbufsize, sizeof(rcvbufsize)) != 0
|| (type != AF_UNIX && setsockopt(so, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one)) != 0))
if (type != AF_UNIX && setsockopt(so, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one)) != 0)
{
MXS_ERROR("Failed to set socket option: %d, %s.", errno, mxs_strerror(errno));
mxb_assert(!true);