Merge branch 'phoenix' into tcp_rate_limiting

This commit is contained in:
Eric Frias 2014-04-17 16:18:22 -04:00
commit f0633f8022
2 changed files with 9 additions and 4 deletions

View file

@ -133,7 +133,7 @@ namespace fc { namespace raw {
mutable_variant_object mvo;
mvo.reserve(vs.value);
for( auto i = 0; i < vs.value; ++i )
for( uint32_t i = 0; i < vs.value; ++i )
{
fc::string key;
fc::variant value;

View file

@ -84,13 +84,18 @@ namespace fc {
if (WSAIoctl(my->_sock.native(), SIO_KEEPALIVE_VALS, &keepalive_settings, sizeof(keepalive_settings),
NULL, 0, &dwBytesRet, NULL, NULL) == SOCKET_ERROR)
wlog("Error setting TCP keepalive values");
#elif !defined( __APPLE__ ) // TODO: add proper support for OS X Mavericks... SOL_TCP and TCP_KEEPIDLE are not defined
#else
// This should work for modern Linuxes and for OSX >= Mountain Lion
int timeout_sec = interval.count() / fc::seconds(1).count();
if (setsockopt(my->_sock.native(), SOL_TCP, TCP_KEEPIDLE,
if (setsockopt(my->_sock.native(), IPPROTO_TCP,
# if defined( __APPLE__ )
TCP_KEEPALIVE,
# else
TCP_KEEPIDLE,
# endif
(char*)&timeout_sec, sizeof(timeout_sec)) < 0)
wlog("Error setting TCP keepalive idle time");
if (setsockopt(my->_sock.native(), SOL_TCP, TCP_KEEPINTVL,
if (setsockopt(my->_sock.native(), IPPROTO_TCP, TCP_KEEPINTVL,
(char*)&timeout_sec, sizeof(timeout_sec)) < 0)
wlog("Error setting TCP keepalive interval");
#endif