diff options
| author | Nils Maier <maierman@web.de> | 2014-07-15 08:16:13 +0200 |
|---|---|---|
| committer | Nils Maier <maierman@web.de> | 2014-07-22 21:58:31 +0200 |
| commit | 8732a244335488e672cf6dcdddf23d6b7454ce8d (patch) | |
| tree | 0dd5fc3f1286aca39c49ce7be4005598fc49221c /src/OptionHandlerFactory.cc | |
| parent | 70a80b1455e11e5572eac4bd4b7ca647c45bbf81 (diff) | |
Try to set sane limits for RLIMIT_NO_FILE
E.g. on OSX the default is 256, which isn't exactly compatible with
torrent downloads.
Closes GH-257
Diffstat (limited to 'src/OptionHandlerFactory.cc')
| -rw-r--r-- | src/OptionHandlerFactory.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc index 409f2eab..f89a1c44 100644 --- a/src/OptionHandlerFactory.cc +++ b/src/OptionHandlerFactory.cc @@ -755,6 +755,25 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers() op->addTag(TAG_ADVANCED); handlers.push_back(op); } +#ifdef HAVE_SYS_RESOURCE_H + { + OptionHandler* op(new NumberOptionHandler + (PREF_RLIMIT_NOFILE, + TEXT_RLIMIT_NOFILE, + // Somewhat sane default that most *nix use. + // Some other *nix, like OSX, have insane defaults like + // 256, hence better *not* get the default value from + // getrlimit(). + "1024", + // 1 should not be a problem in practise, since the code + // will only adjust if the specified value > the current + // soft limit. + // And sane systems have a default soft limit > 1. + 1)); + op->addTag(TAG_ADVANCED); + handlers.push_back(op); + } +#endif // HAVE_SYS_RESOURCE_H { OptionHandler* op(new BooleanOptionHandler (PREF_SELECT_LEAST_USED_HOST, |
