diff options
author | Simon Rettberg | 2019-12-13 16:45:18 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-12-13 16:45:18 +0100 |
commit | 38eff50100c906a46177c54da3382c661527e6a1 (patch) | |
tree | ae1947cd8b7a336c586d393202b99e31b3f1e3f6 | |
parent | Compat hack for OpenSSL < 1.1.0 (diff) | |
download | ldadp-38eff50100c906a46177c54da3382c661527e6a1.tar.gz ldadp-38eff50100c906a46177c54da3382c661527e6a1.tar.xz ldadp-38eff50100c906a46177c54da3382c661527e6a1.zip |
Increase send/receive buffer to 500k
-rw-r--r-- | client.c | 10 | ||||
-rw-r--r-- | types.h | 2 |
2 files changed, 5 insertions, 7 deletions
@@ -10,8 +10,6 @@ #include <stdio.h> #include <errno.h> -#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; } @@ -17,7 +17,7 @@ #define MAXPATH 200 #define REQLEN 4000 -#define MAXMSGLEN 100000 +#define MAXMSGLEN 500000 #define BOOL uint8_t #define TRUE (1) |