Raise the current file descriptor limit to the maximum.

This commit is contained in:
JoelKatz
2013-07-15 14:58:04 -07:00
parent a00c62c969
commit c8af7141f3
2 changed files with 16 additions and 0 deletions

View File

@@ -17,6 +17,10 @@
// This must come first to work around the boost placeholders issues
#include "beast/modules/beast_basics/beast_basics.h"
#if BEAST_LINUX || BEAST_MAC || BEAST_BSD
#include <sys/resource.h>
#endif
// VFALCO NOTE Holy smokes...that's a lot of boost!!!
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>

View File

@@ -8,6 +8,18 @@ namespace po = boost::program_options;
void setupServer ()
{
#ifdef RLIMIT_NOFILE
struct rlimit rl;
if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
{
if (rl.rlim_cur != rl.rlim_max)
{
rl.rlim_cur = rl.rlim_max;
setrlimit(RLIMIT_NOFILE, &r1);
}
}
#endif
getApp().setup ();
}