diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-18 09:42:49 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-18 09:42:49 +0800 |
commit | 2d5091f543421dbd09f588ed500868578a3cfb50 (patch) | |
tree | 08bac696242224d4ddc8db8d8d922cb5c99c954f /daemon | |
parent | fddfadb086f3ca12266c9add4df5c483b76d057d (diff) | |
download | pttbbs-2d5091f543421dbd09f588ed500868578a3cfb50.tar pttbbs-2d5091f543421dbd09f588ed500868578a3cfb50.tar.gz pttbbs-2d5091f543421dbd09f588ed500868578a3cfb50.tar.bz2 pttbbs-2d5091f543421dbd09f588ed500868578a3cfb50.tar.lz pttbbs-2d5091f543421dbd09f588ed500868578a3cfb50.tar.xz pttbbs-2d5091f543421dbd09f588ed500868578a3cfb50.tar.zst pttbbs-2d5091f543421dbd09f588ed500868578a3cfb50.zip |
* increase tunnel buffer size
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4655 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/logind/logind.c | 17 |
1 files changed, 17 insertions, 0 deletions
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 @@ -670,6 +670,22 @@ _set_connection_opt(int sock) } 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) { const int on = 1; @@ -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; |