From ca6f4718deb56367bbae33312e0f341e0595f3eb Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Tue, 15 May 2018 00:24:58 +0200 Subject: client: Set socket options for client connections to improve performance --- src/client.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/client.c b/src/client.c index a9d09d3..a9c986a 100644 --- a/src/client.c +++ b/src/client.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -171,6 +172,17 @@ int client_accept(int listenfd) } } + int bufsize = 0x20000; + if (setsockopt(cfd, SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof(int)) == -1) { + usbmuxd_log(LL_WARNING, "Could not set send buffer for client socket"); + } + if (setsockopt(cfd, SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof(int)) == -1) { + usbmuxd_log(LL_WARNING, "Could not set receive buffer for client socket"); + } + + int yes = 1; + setsockopt(cfd, IPPROTO_TCP, TCP_NODELAY, (void*)&yes, sizeof(int)); + struct mux_client *client; client = malloc(sizeof(struct mux_client)); memset(client, 0, sizeof(struct mux_client)); -- cgit v1.1-32-gdbae