Add hard fileno (#366)

* increase the fileno limit

This allows wstunnel to use fds>1024.
Otherwise heavy use can easily run out of file descriptors on connection
attempts.
While there will still be a limit, it is significantly higher (~500
times on my system) which provides enough headroom for connections to be
torn down and fds to be closed.
This commit is contained in:
Ongy 2024-11-08 19:51:56 +01:00 committed by GitHub
parent 820cb2232a
commit 05043954af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 1 deletions

View file

@ -19,7 +19,7 @@ use base64::Engine;
use clap::Parser;
use hyper::header::HOST;
use hyper::http::{HeaderName, HeaderValue};
use log::debug;
use log::{debug, warn};
use parking_lot::{Mutex, RwLock};
use std::collections::BTreeMap;
use std::fmt::Debug;
@ -727,6 +727,9 @@ async fn main() -> anyhow::Result<()> {
} else {
logger.init();
};
if let Err(err) = fdlimit::raise_fd_limit() {
warn!("Failed to set soft filelimit to hard file limit: {}", err)
}
match args.commands {
Commands::Client(args) => {