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
use ;
pub const DEFAULT_ADDR: =
new;
/// The default server address.
pub const DEFAULT_IPV4: &str = "0.0.0.0:9177";
/// The maximum number of connections allowed by the server.
pub const DEFAULT_MAX_CONNECTIONS: usize = 1000;
/// The maximum number of threads allowed by the server.
pub const DEFAULT_MAX_REACTOR_TASKPOOL_SIZE: usize = 512;
/// The default maximum receive data size for a single client in bytes.
pub const DEFAULT_MAX_RECEIVE_BYTES_SIZE: usize = 1024;
/// The default system channel size, used to store the maximum number of messages that can be buffered in the system channel.
pub const DEFAULT_SYSTEM_CHANNEL_SIZE: usize = 64;
/// The default maximum processing permit size for a single client.
/// Assuming the single processing delay is controlled within 100ms, the server allows processing at least 14 requests from a single client within 100ms.
pub const DEFAULT_PROCESS_PERMIT_SIZE: usize = 14;
/// The interval for heartbeat detection in seconds.
pub const DEFAULT_CHECK_HEART_INTERVAL: u64 = 5;
/// The timeout time for heartbeat detection in seconds.
pub const DEFAULT_CHECK_HEART_TIMEOUT_TIME: u64 = 30;
/// The default message header mark, used to identify the start of a message.
pub const DEFAULT_MESSAGE_HEADER_MARK: u16 = 9177;
/// The default message tail mark, used to identify the end of a message.
pub const DEFAULT_MESSAGE_TAIL_MARK: u16 = 7719;
/// A OnceLock for the server message header mark, used to store the message header mark for the server.
pub static SERVER_MESSAGE_HEADER_MARK: = new;
/// A OnceLock for the server message tail mark, used to store the message tail mark for the server.
pub static SERVER_MESSAGE_TAIL_MARK: = new;
/// The default maximum number of connections allowed per IP address.
pub const DEFAULT_MAX_CONNECTIONS_PER_IP: usize = 10;
/// The default connection rate limit (connections per second). 0 means no limit.
pub const DEFAULT_CONNECTION_RATE_LIMIT: u64 = 100;
/// The default TCP_NODELAY setting.
pub const DEFAULT_TCP_NODELAY: bool = true;
/// The default TCP keep-alive enabled setting.
pub const DEFAULT_TCP_KEEPALIVE_ENABLED: bool = false;
/// The default TCP keep-alive time in seconds.
pub const DEFAULT_TCP_KEEPALIVE_TIME_SECS: u64 = 60;
/// The default read timeout in seconds. 0 means no timeout.
pub const DEFAULT_READ_TIMEOUT_SECS: u64 = 0;
/// The default write timeout in seconds. 0 means no timeout.
pub const DEFAULT_WRITE_TIMEOUT_SECS: u64 = 0;
/// The default receive buffer size in bytes.
pub const DEFAULT_RECV_BUFFER_SIZE: usize = 8192;
/// The default send buffer size in bytes.
pub const DEFAULT_SEND_BUFFER_SIZE: usize = 8192;
/// The default maximum number of connection attempts per connection session
/// (initial connect and each automatic reconnect), used by the client.
pub const DEFAULT_RECONNECT_MAX_ATTEMPTS: usize = 3;
/// The default delay in seconds between two client connection attempts.
pub const DEFAULT_RECONNECT_INTERVAL_SECS: u64 = 1;
/// The default connect (and TLS handshake) timeout for the client in seconds.
pub const DEFAULT_CONNECT_TIMEOUT_SECS: u64 = 3;
/// The maximum time in seconds a server-side TLS handshake may take before
/// the connection is dropped.
pub const TLS_HANDSHAKE_TIMEOUT_SECS: u64 = 10;