On Mac OS X getrlimit() returns 2^(sizeof(size_t) * 8) instead of the actual number of available socket descriptors.

This commit is contained in:
Jan Vidar Krey 2010-01-26 08:40:10 +01:00
parent e3cf41cb97
commit 928225fb7b

View File

@ -69,7 +69,7 @@ size_t net_get_max_sockets()
struct rlimit limits; struct rlimit limits;
if (getrlimit(RLIMIT_NOFILE, &limits) == 0) if (getrlimit(RLIMIT_NOFILE, &limits) == 0)
{ {
return limits.rlim_max; return MIN(limits.rlim_max, 65536);
} }
LOG_ERROR("getrlimit() failed"); LOG_ERROR("getrlimit() failed");
return 1024; return 1024;