Merge remote-tracking branch 'upstream/phoenix' into http-server-improvements

This commit is contained in:
valzav 2014-05-05 15:38:41 -07:00
commit e02a509b30

View file

@ -106,22 +106,22 @@ namespace fc {
if (WSAIoctl(my->_sock.native(), SIO_KEEPALIVE_VALS, &keepalive_settings, sizeof(keepalive_settings), if (WSAIoctl(my->_sock.native(), SIO_KEEPALIVE_VALS, &keepalive_settings, sizeof(keepalive_settings),
NULL, 0, &dwBytesRet, NULL, NULL) == SOCKET_ERROR) NULL, 0, &dwBytesRet, NULL, NULL) == SOCKET_ERROR)
wlog("Error setting TCP keepalive values"); wlog("Error setting TCP keepalive values");
#else #elif !defined(__clang__) || (__clang_major__ >= 6)
# if !defined(__clang__) || (__clang_major__ >= 6)
// This should work for modern Linuxes and for OSX >= Mountain Lion // This should work for modern Linuxes and for OSX >= Mountain Lion
int timeout_sec = interval.count() / fc::seconds(1).count(); int timeout_sec = interval.count() / fc::seconds(1).count();
if (setsockopt(my->_sock.native(), IPPROTO_TCP, if (setsockopt(my->_sock.native(), IPPROTO_TCP,
# if defined( __APPLE__ ) #if defined( __APPLE__ )
TCP_KEEPALIVE, TCP_KEEPALIVE,
# else #else
TCP_KEEPIDLE, TCP_KEEPIDLE,
# endif #endif
(char*)&timeout_sec, sizeof(timeout_sec)) < 0) (char*)&timeout_sec, sizeof(timeout_sec)) < 0)
wlog("Error setting TCP keepalive idle time"); wlog("Error setting TCP keepalive idle time");
#ifndef __APPLE__ // TCP_KEEPINTVL does not seem to work on 10.8.4
if (setsockopt(my->_sock.native(), IPPROTO_TCP, TCP_KEEPINTVL, if (setsockopt(my->_sock.native(), IPPROTO_TCP, TCP_KEEPINTVL,
(char*)&timeout_sec, sizeof(timeout_sec)) < 0) (char*)&timeout_sec, sizeof(timeout_sec)) < 0)
wlog("Error setting TCP keepalive interval"); wlog("Error setting TCP keepalive interval");
# endif #endif // !__APPLE__
#endif #endif
} }
else else