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:
parent
820cb2232a
commit
05043954af
3 changed files with 17 additions and 1 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -765,6 +765,16 @@ dependencies = [
|
|||
"utf-8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fdlimit"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e182f7dbc2ef73d9ef67351c5fbbea084729c48362d3ce9dd44c28e32e277fe5"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.25"
|
||||
|
@ -3128,6 +3138,7 @@ dependencies = [
|
|||
"crossterm",
|
||||
"fast-socks5",
|
||||
"fastwebsockets",
|
||||
"fdlimit",
|
||||
"futures-util",
|
||||
"hickory-resolver",
|
||||
"http-body-util",
|
||||
|
|
|
@ -23,6 +23,8 @@ ppp = { version = "2.2.0", features = [] }
|
|||
async-channel = { version = "2.3.1", features = [] }
|
||||
arc-swap = { version = "1.7.1", features = [] }
|
||||
|
||||
fdlimit = "0.3.0"
|
||||
|
||||
# For config file parsing
|
||||
regex = { version = "1.11.0", default-features = false, features = ["std", "perf"] }
|
||||
serde_regex = "1.1.0"
|
||||
|
|
|
@ -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) => {
|
||||
|
|
Loading…
Reference in a new issue