1
0
Fork 0
mirror of https://passt.top/passt synced 2025-06-17 12:45:34 +02:00

tcp_splice: Close sockets right away on high number of open files

We can't take for granted that the hard limit for open files is
big enough as to allow to delay closing sockets to a timer.

Store the value of RTLIMIT_NOFILE we set at start, and use it to
understand if we're approaching the limit with pending, spliced
TCP connections. If that's the case, close sockets right away as
soon as they're not needed, instead of deferring this task to a
timer.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2022-03-19 00:33:46 +01:00
parent be5bbb9b06
commit 92074c16a8
5 changed files with 27 additions and 7 deletions

View file

@ -98,6 +98,7 @@ enum passt_modes {
* @quiet: Don't print informational messages
* @foreground: Run in foreground, don't log to stderr by default
* @stderr: Force logging to stderr
* @nofile: Maximum number of open files (ulimit -n)
* @sock_path: Path for UNIX domain socket
* @pcap: Path for packet capture file
* @pid_file: Path to PID file, empty string if not configured
@ -160,6 +161,7 @@ struct ctx {
int quiet;
int foreground;
int stderr;
int nofile;
char sock_path[UNIX_PATH_MAX];
char pcap[PATH_MAX];
char pid_file[PATH_MAX];