From 2d5091f543421dbd09f588ed500868578a3cfb50 Mon Sep 17 00:00:00 2001 From: piaip Date: Thu, 18 Jun 2009 01:42:49 +0000 Subject: * increase tunnel buffer size git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4655 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- daemon/logind/logind.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'daemon') diff --git a/daemon/logind/logind.c b/daemon/logind/logind.c index c1bfa993..4e8149ef 100644 --- a/daemon/logind/logind.c +++ b/daemon/logind/logind.c @@ -669,6 +669,22 @@ _set_connection_opt(int sock) return 0; } +static int +_set_tunnel_opt(int sock) +{ + const int szrecv = 131072, szsend = 131072; + + // adjust transmission window + if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&szrecv, sizeof(szrecv)) < 0 || + setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (void*)&szsend, sizeof(szsend)) < 0) + { + fprintf(stderr, LOG_PREFIX "WARNING: " + "set_tunnel_opt: failed to increase buffer to (%u,%u)\r\n", szsend, szrecv); + } + + return 0; +} + static int _set_bind_opt(int sock) { @@ -1769,6 +1785,7 @@ tunnel_cb(int fd, short event, void *arg) // got new tunnel fprintf(stderr, LOG_PREFIX "new tunnel established.\r\n"); _set_connection_opt(cfd); + _set_tunnel_opt(cfd); stop_g_tunnel(); g_tunnel = cfd; -- cgit v1.2.3