diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-07 17:34:04 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-07 17:34:04 +0800 |
commit | a03f510b71af8506ac9b23e55a0d129e8945690e (patch) | |
tree | a8593664a043a8cdbfab435e5483cd81753f7280 /mbbsd | |
parent | cf2e032c6b60314e5e92e578f5c3147e11b8fdbd (diff) | |
download | pttbbs-a03f510b71af8506ac9b23e55a0d129e8945690e.tar pttbbs-a03f510b71af8506ac9b23e55a0d129e8945690e.tar.gz pttbbs-a03f510b71af8506ac9b23e55a0d129e8945690e.tar.bz2 pttbbs-a03f510b71af8506ac9b23e55a0d129e8945690e.tar.lz pttbbs-a03f510b71af8506ac9b23e55a0d129e8945690e.tar.xz pttbbs-a03f510b71af8506ac9b23e55a0d129e8945690e.tar.zst pttbbs-a03f510b71af8506ac9b23e55a0d129e8945690e.zip |
* it seems still better to use KEEP_ALIVE, although detection duratio is long...
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4511 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/mbbsd.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index a89d6e3b..0fe860e1 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1461,12 +1461,13 @@ set_connection_opt(int sock) const int szrecv = 1024, szsend=4096; const struct linger lin = {0}; - // keep alive: server will check target connection. - // const int on = 1; - // setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&on, sizeof(on)); + // keep alive: server will check target connection (default 2 hours) + const int on = 1; + setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void*)&on, sizeof(on)); // fast close setsockopt(sock, SOL_SOCKET, SO_LINGER, &lin, sizeof(lin)); + // adjust transmission window setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&szrecv, sizeof(szrecv)); setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (void*)&szsend, sizeof(szsend)); @@ -1480,7 +1481,7 @@ set_bind_opt(int sock) { const int on = 1; - setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)); + setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*)&on, sizeof(on)); set_connection_opt(sock); return 0; |