@@ -17,7 +17,7 @@ impl TcpRequest {
1717
1818 fn read_response ( & mut self , stream : & mut TcpStream ) -> Result < BoxResponseTrait , RequestError > {
1919 let cfg_buffer_size: usize = self
20- . get_config ( )
20+ . config
2121 . read ( )
2222 . map_or ( DEFAULT_BUFFER_SIZE , |data| data. buffer_size ) ;
2323 let mut tmp_buf: Vec < u8 > = vec ! [ 0u8 ; cfg_buffer_size] ;
@@ -39,7 +39,7 @@ impl TcpRequest {
3939 fn get_connection_stream ( & self , host : String , port : usize ) -> Result < TcpStream , RequestError > {
4040 let host_port: ( String , u16 ) = ( host. clone ( ) , port as u16 ) ;
4141 let cfg_timeout: u64 = self
42- . get_config ( )
42+ . config
4343 . read ( )
4444 . map_or ( DEFAULT_TIMEOUT , |data| data. timeout ) ;
4545 let timeout: Duration = Duration :: from_millis ( cfg_timeout) ;
@@ -61,11 +61,11 @@ impl RequestTrait for TcpRequest {
6161
6262 fn send ( & mut self , data : & [ u8 ] ) -> Self :: RequestResult {
6363 let cfg_timeout: Config = self
64- . get_config ( )
64+ . config
6565 . read ( )
6666 . map_or ( Config :: default ( ) , |data| data. clone ( ) ) ;
67- let host: String = cfg_timeout. get_host ( ) . clone ( ) ;
68- let port: usize = cfg_timeout. get_port ( ) . clone ( ) ;
67+ let host: String = cfg_timeout. host . clone ( ) ;
68+ let port: usize = cfg_timeout. port . clone ( ) ;
6969 let mut stream: TcpStream = self
7070 . get_connection_stream ( host, port)
7171 . map_err ( |_| RequestError :: TcpStreamConnectError ) ?;
0 commit comments