summaryrefslogtreecommitdiff
path: root/crates/arti/src/process.rs
blob: 8c12054278396854237571bb2e706bb229a5d11b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Code to adjust process-related parameters.

use arti_client::TorClientConfig;

/// Set our current maximum-file limit to a large value, if we can.
///
/// Since we're going to be used as a proxy, we're likely to need a
/// _lot_ of simultaneous sockets.
///
/// # Limitations
///
/// This doesn't actually do anything on windows.
pub(crate) fn use_max_file_limit(config: &TorClientConfig) {
    match rlimit::utils::increase_nofile_limit(config.system.max_files) {
        Ok(n) => tracing::debug!("Increased process file limit to {}", n),
        Err(e) => tracing::warn!("Error while increasing file limit: {}", e),
    }
}