Пример #1
0
/** Initialize process fd limit to MAXCONNECTIONS.
 */
int init_connection_limits(void)
{
  int limit = os_set_fdlimit(MAXCONNECTIONS);
  if (0 == limit)
    return 1;
  if (limit < 0) {
    fprintf(stderr, "error setting max fd's to %d\n", limit);
  }
  else if (limit > 0) {
    fprintf(stderr, "ircd fd table too big\nHard Limit: %d IRC max: %d\n",
            limit, MAXCONNECTIONS);
    fprintf(stderr, "set MAXCONNECTIONS to a smaller value");
  }
  return 0;
}
Пример #2
0
/** Initialize process fd limit.
 * @param[in] maxconn Maximum number of connections to support.
 * @return Non-zero on success, zero on error.
 */
int init_connection_limits(int maxconn)
{
  int limit = os_set_fdlimit(maxconn);
  if (0 == limit) {
    LocalClientArray = MyCalloc(maxconn, sizeof(LocalClientArray[0]));
    if (!LocalClientArray) {
      fprintf(stderr, "unable to allocate client array for %d clients\n", maxconn);
      return 0;
    }
    return 1;
  }
  if (limit < 0) {
    fprintf(stderr, "error setting max fds to %d: %s\n", maxconn, strerror(errno));
  }
  else if (limit > 0) {
    fprintf(stderr, "ircd fd table too big\nHard Limit: %d IRC max: %d\n"
            "set MAXCONNECTIONS or -m to a smaller value\n",
            limit, maxconn);
  }
  return 0;
}