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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
use std::time::Duration;
use std::sync::Arc;
use server::{Config};
impl Config {
pub fn new() -> Config {
Config {
inflight_request_limit: 2,
inflight_request_prealloc: 0,
first_byte_timeout: Duration::new(5, 0),
keep_alive_timeout: Duration::new(90, 0),
headers_timeout: Duration::new(10, 0),
input_body_byte_timeout: Duration::new(15, 0),
input_body_whole_timeout: Duration::new(3600, 0),
output_body_byte_timeout: Duration::new(15, 0),
output_body_whole_timeout: Duration::new(3600, 0),
}
}
pub fn inflight_request_limit(&mut self, value: usize) -> &mut Self {
self.inflight_request_limit = value;
self
}
pub fn inflight_request_prealoc(&mut self, value: usize) -> &mut Self {
self.inflight_request_prealloc = value;
self
}
pub fn done(&mut self) -> Arc<Config> {
Arc::new(self.clone())
}
pub fn first_byte_timeout(&mut self, value: Duration) -> &mut Self {
self.first_byte_timeout = value;
self
}
pub fn keep_alive_timeout(&mut self, value: Duration) -> &mut Self {
self.keep_alive_timeout = value;
self
}
pub fn headers_timeout(&mut self, value: Duration) -> &mut Self {
self.headers_timeout = value;
self
}
pub fn input_body_byte_timeout(&mut self, value: Duration) -> &mut Self {
self.input_body_byte_timeout = value;
self
}
pub fn input_body_whole_timeout(&mut self, value: Duration) -> &mut Self {
self.input_body_whole_timeout = value;
self
}
pub fn output_body_byte_timeout(&mut self, value: Duration) -> &mut Self {
self.output_body_byte_timeout = value;
self
}
pub fn output_body_whole_timeout(&mut self, value: Duration) -> &mut Self {
self.output_body_whole_timeout = value;
self
}
}