1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use std::{
io::{self, ErrorKind::*},
net::{IpAddr, Ipv4Addr},
};
#[derive(Debug, Clone)]
pub struct NodeConfig {
pub name: Option<String>,
pub listener_ip: IpAddr,
pub desired_listening_port: Option<u16>,
pub allow_random_port: bool,
pub protocol_handler_queue_depth: usize,
pub conn_read_buffer_size: usize,
pub conn_write_buffer_size: usize,
pub conn_inbound_queue_depth: usize,
pub conn_outbound_queue_depth: usize,
pub invalid_read_delay_secs: u64,
pub fatal_io_errors: Vec<io::ErrorKind>,
pub max_connections: u16,
pub max_handshake_time_ms: u64,
}
impl Default for NodeConfig {
fn default() -> Self {
Self {
name: None,
listener_ip: IpAddr::V4(Ipv4Addr::UNSPECIFIED),
desired_listening_port: None,
allow_random_port: true,
protocol_handler_queue_depth: 16,
conn_read_buffer_size: 64 * 1024,
conn_write_buffer_size: 64 * 1024,
conn_inbound_queue_depth: 64,
conn_outbound_queue_depth: 64,
invalid_read_delay_secs: 10,
fatal_io_errors: vec![
ConnectionReset,
ConnectionAborted,
BrokenPipe,
InvalidData,
UnexpectedEof,
],
max_connections: 100,
max_handshake_time_ms: 3_000,
}
}
}