@@ -8,16 +8,28 @@ const MAX_IDENT_LEN: u64 = 256;
8
8
const CODE_SUCCESS : u8 = 90 ;
9
9
const CODE_FAILURE : u8 = 91 ;
10
10
11
- struct Handler {
12
- client_read_timeout : Duration ,
13
- client_write_timeout : Duration ,
14
- upstream_connect_timeout : Duration ,
15
- upstream_read_timeout : Duration ,
16
- upstream_write_timeout : Duration ,
11
+ pub struct Handler {
12
+ pub client_read_timeout : Duration ,
13
+ pub client_write_timeout : Duration ,
14
+ pub upstream_connect_timeout : Duration ,
15
+ pub upstream_read_timeout : Duration ,
16
+ pub upstream_write_timeout : Duration ,
17
+ }
18
+
19
+ impl Default for Handler {
20
+ fn default ( ) -> Self {
21
+ Self {
22
+ client_read_timeout : Duration :: from_secs ( 60 ) ,
23
+ client_write_timeout : Duration :: from_secs ( 60 ) ,
24
+ upstream_connect_timeout : Duration :: from_secs ( 10 ) ,
25
+ upstream_read_timeout : Duration :: from_secs ( 60 ) ,
26
+ upstream_write_timeout : Duration :: from_secs ( 60 ) ,
27
+ }
28
+ }
17
29
}
18
30
19
31
impl Handler {
20
- fn handle ( & self , mut client : TcpStream ) -> io:: Result < ( ) > {
32
+ pub fn handle ( & self , mut client : TcpStream ) -> io:: Result < ( ) > {
21
33
client. set_read_timeout ( Some ( self . client_read_timeout ) ) ?;
22
34
client. set_write_timeout ( Some ( self . client_write_timeout ) ) ?;
23
35
let mut client_reader = BufReader :: new ( client. try_clone ( ) ?) ;
0 commit comments