diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-07 17:48:59 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-07 17:48:59 +0800 |
commit | 1f90d5e34bdd24a01e1d0a42d663e39d88279161 (patch) | |
tree | 9e354f89bf7c39364ab337de2ba8dc9e87ba98ef | |
parent | 280c61eeb3dc29c336e3a59b63b4d6baa41f7498 (diff) | |
download | pttbbs-1f90d5e34bdd24a01e1d0a42d663e39d88279161.tar pttbbs-1f90d5e34bdd24a01e1d0a42d663e39d88279161.tar.gz pttbbs-1f90d5e34bdd24a01e1d0a42d663e39d88279161.tar.bz2 pttbbs-1f90d5e34bdd24a01e1d0a42d663e39d88279161.tar.lz pttbbs-1f90d5e34bdd24a01e1d0a42d663e39d88279161.tar.xz pttbbs-1f90d5e34bdd24a01e1d0a42d663e39d88279161.tar.zst pttbbs-1f90d5e34bdd24a01e1d0a42d663e39d88279161.zip |
* experimental sending keepalive packets (hope this can reduce user's auto-disconnect issue)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@4512 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/mbbsd/mbbsd.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pttbbs/mbbsd/mbbsd.c b/pttbbs/mbbsd/mbbsd.c index 0fe860e1..c6d9f182 100644 --- a/pttbbs/mbbsd/mbbsd.c +++ b/pttbbs/mbbsd/mbbsd.c @@ -1462,8 +1462,15 @@ set_connection_opt(int sock) const struct linger lin = {0}; // keep alive: server will check target connection (default 2 hours) - const int on = 1; + const int on = 1; setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void*)&on, sizeof(on)); + +#if defined(SOL_TCP) && defined(TCP_KEEPIDLE) + { + const int idle = 300*2; // experimental, minimal keep alive check + setsockopt(sock, SOL_TCP, TCP_KEEPIDLE, (void*)idle, sizeof(idle)); + } +#endif // fast close setsockopt(sock, SOL_SOCKET, SO_LINGER, &lin, sizeof(lin)); |