Browse Source

Read off the max open file limits and clamp max clients to 90% of it

master
Con Kolivas 9 years ago
parent
commit
84c6f0f900
  1. 11
      src/ckpool.c

11
src/ckpool.c

@ -2131,6 +2131,17 @@ int main(int argc, char **argv)
launch_logger(&ckp.main);
ckp.logfd = fileno(ckp.logfp);
ret = sysconf(_SC_OPEN_MAX);
if (ckp.maxclients > ret * 9 / 10) {
LOGWARNING("Cannot set maxclients to %d due to max open file limit of %d, reducing to %d",
ckp.maxclients, ret, ret * 9 / 10);
ckp.maxclients = ret * 9 / 10;
} else if (!ckp.maxclients) {
LOGNOTICE("Setting maxclients to %d due to max open file limit of %d",
ret * 9 / 10, ret);
ckp.maxclients = ret * 9 / 10;
}
ckp.ckpapi = create_ckmsgq(&ckp, "api", &ckpool_api);
create_pthread(&ckp.pth_listener, listener, &ckp.main);

Loading…
Cancel
Save