From 38eff50100c906a46177c54da3382c661527e6a1 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 13 Dec 2019 16:45:18 +0100 Subject: Increase send/receive buffer to 500k --- client.c | 10 ++++------ types.h | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/client.c b/client.c index 41cda25..e99ef09 100644 --- a/client.c +++ b/client.c @@ -10,8 +10,6 @@ #include #include -#define MAX_SEND_BUFFER 150000 - static void client_haveIn(epoll_client_t *client); static BOOL client_haveOut(epoll_client_t *client); @@ -175,7 +173,7 @@ static BOOL client_haveOut(epoll_client_t *client) if (client->ssl == NULL && ret != tosend) return TRUE; // Sent less than requested -> buffer full, epoll will trigger us again } client->sbPos = client->sbFill = 0; - if (client->ssl == NULL && client->sbLen > MAX_SEND_BUFFER / 2) { + if (client->ssl == NULL && client->sbLen > MAXMSGLEN / 2) { helper_realloc(&client->sendBuffer, &client->sbLen, 8000, "client_haveOut"); } return TRUE; @@ -211,13 +209,13 @@ BOOL client_send(epoll_client_t *client, const char *buffer, size_t len, const B client->sbPos = 0; } // Sanity - if (client->sbFill + len > MAX_SEND_BUFFER) { - printf("[Proxy] Dropping client as the send buffer would exceed %d bytes.\n", (int)MAX_SEND_BUFFER); + if (client->sbFill + len > MAXMSGLEN) { + printf("[Proxy] Dropping client as the send buffer would exceed %d bytes.\n", (int)MAXMSGLEN); client->kill = TRUE; return FALSE; } if (client->sbLen - client->sbFill < len) { // Still too small after compacting? realloc - if (helper_realloc(&client->sendBuffer, &client->sbLen, client->sbLen + len + (client->ssl && client->sbLen > 0 ? MAX_SEND_BUFFER : 4000), "client_send") == -1) { + if (helper_realloc(&client->sendBuffer, &client->sbLen, client->sbLen + len + (client->ssl && client->sbLen > 0 ? MAXMSGLEN : 4000), "client_send") == -1) { client->kill = TRUE; return FALSE; } diff --git a/types.h b/types.h index ff2ddf4..3508ae3 100644 --- a/types.h +++ b/types.h @@ -17,7 +17,7 @@ #define MAXPATH 200 #define REQLEN 4000 -#define MAXMSGLEN 100000 +#define MAXMSGLEN 500000 #define BOOL uint8_t #define TRUE (1) -- cgit v1.2.3-55-g7522