stratum-server 5.7.5

The server code for the Rust Stratum implementation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use rlimit::{setrlimit, Resource};

const DEFAULT_SOFT_LIMIT: u64 = 4 * 1024 * 1024;
const DEFAULT_HARD_LIMIT: u64 = 8 * 1024 * 1024;

//@todo https://docs.rs/rlimit/latest/rlimit/
pub fn fix_ulimit() {
    assert!(Resource::FSIZE
        .set(DEFAULT_SOFT_LIMIT, DEFAULT_HARD_LIMIT)
        .is_ok());

    let soft = 16384;
    let hard = soft * 2;
    assert!(setrlimit(Resource::NOFILE, soft, hard).is_ok());
}