aboutgitcodebugslistschat
path: root/passt.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-03-19 00:33:46 +0100
committerStefano Brivio <sbrivio@redhat.com>2022-03-29 15:35:38 +0200
commit92074c16a8dda83d79c4e9a534757b0e116f7157 (patch)
tree0b0b88a4e3b02562bbd7233b564878d95886a850 /passt.c
parentbe5bbb9b06811b98f677460fd2b89001db580582 (diff)
downloadpasst-92074c16a8dda83d79c4e9a534757b0e116f7157.tar
passt-92074c16a8dda83d79c4e9a534757b0e116f7157.tar.gz
passt-92074c16a8dda83d79c4e9a534757b0e116f7157.tar.bz2
passt-92074c16a8dda83d79c4e9a534757b0e116f7157.tar.lz
passt-92074c16a8dda83d79c4e9a534757b0e116f7157.tar.xz
passt-92074c16a8dda83d79c4e9a534757b0e116f7157.tar.zst
passt-92074c16a8dda83d79c4e9a534757b0e116f7157.zip
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>
Diffstat (limited to 'passt.c')
-rw-r--r--passt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/passt.c b/passt.c
index 6550a22..292cf53 100644
--- a/passt.c
+++ b/passt.c
@@ -371,7 +371,7 @@ int main(int argc, char **argv)
perror("getrlimit");
exit(EXIT_FAILURE);
}
- limit.rlim_cur = limit.rlim_max;
+ c.nofile = limit.rlim_cur = limit.rlim_max;
if (setrlimit(RLIMIT_NOFILE, &limit)) {
perror("setrlimit");
exit(EXIT_FAILURE);