mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 00:37:00 +08:00
update_fd_limits: set fd limits for "unlimited" users to 8k
Relates: #349 Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
This commit is contained in:
@@ -37,6 +37,9 @@ void init_fd_limits_default(main_server_st * s)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* (Maximum clients) + (small buffer) + (sec mod fds) */
|
||||
#define MAX_FD_LIMIT(clients) (clients + 32 + s->sec_mod_instance_count * 2)
|
||||
|
||||
/* Adjusts the file descriptor limits for the main or worker processes
|
||||
*/
|
||||
void update_fd_limits(main_server_st * s, unsigned main)
|
||||
@@ -49,11 +52,11 @@ void update_fd_limits(main_server_st * s, unsigned main)
|
||||
if (main) {
|
||||
if (GETCONFIG(s)->max_clients > 0)
|
||||
// FUTURE: Should this be raises to account for scripts?
|
||||
max = GETCONFIG(s)->max_clients + 32 + s->sec_mod_instance_count * 2;
|
||||
max = MAX_FD_LIMIT(GETCONFIG(s)->max_clients);
|
||||
else
|
||||
// If the admin doesn't specify max_clients,
|
||||
// then we are limiting it to around 4K.
|
||||
max = 4 * 1024;
|
||||
// then we are limiting it to around 8K.
|
||||
max = MAX_FD_LIMIT(8 * 1024);
|
||||
|
||||
if (max > s->fd_limits_default_set.rlim_cur) {
|
||||
new_set.rlim_cur = max;
|
||||
|
||||
Reference in New Issue
Block a user