@@ -21,31 +21,24 @@ use tower_service::Service;
21
21
22
22
use crate :: common:: url:: Url ;
23
23
use crate :: protocol:: Invoker ;
24
- use crate :: triple:: transport :: connection :: Connection ;
24
+ use crate :: triple:: client :: builder :: { ClientBoxService , ClientBuilder } ;
25
25
26
- #[ allow( dead_code) ]
27
- #[ derive( Clone , Default ) ]
28
26
pub struct TripleInvoker {
29
27
url : Url ,
30
- conn : Connection ,
28
+ conn : ClientBoxService ,
31
29
}
32
30
33
31
impl TripleInvoker {
34
32
pub fn new ( url : Url ) -> TripleInvoker {
35
33
let uri = http:: Uri :: from_str ( & url. to_url ( ) ) . unwrap ( ) ;
36
34
Self {
37
35
url,
38
- conn : Connection :: new ( ) . with_host ( uri ) ,
36
+ conn : ClientBuilder :: from ( uri ) . connect ( ) ,
39
37
}
40
38
}
41
39
}
42
40
43
- impl < ReqBody > Invoker < http:: Request < ReqBody > > for TripleInvoker
44
- where
45
- ReqBody : http_body:: Body + Unpin + Send + ' static ,
46
- ReqBody :: Error : Into < crate :: Error > ,
47
- ReqBody :: Data : Send + Unpin ,
48
- {
41
+ impl Invoker < http:: Request < hyper:: Body > > for TripleInvoker {
49
42
type Response = http:: Response < crate :: BoxBody > ;
50
43
51
44
type Error = crate :: Error ;
56
49
self . url . clone ( )
57
50
}
58
51
59
- fn call ( & mut self , req : http:: Request < ReqBody > ) -> Self :: Future {
52
+ fn call ( & mut self , req : http:: Request < hyper :: Body > ) -> Self :: Future {
60
53
self . conn . call ( req)
61
54
}
55
+
56
+ fn poll_ready (
57
+ & mut self ,
58
+ cx : & mut std:: task:: Context < ' _ > ,
59
+ ) -> std:: task:: Poll < Result < ( ) , Self :: Error > > {
60
+ self . conn . poll_ready ( cx)
61
+ }
62
62
}
0 commit comments