File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -424,7 +424,17 @@ cfg_sync! {
424424
425425 let path = path. to_str( ) . ok_or( crate :: Error :: InvalidUTF8Path ) ?. to_owned( ) ;
426426
427+ let https = super :: connector( ) ?;
428+ use tower:: ServiceExt ;
429+
430+ let svc = https
431+ . map_err( |e| e. into( ) )
432+ . map_response( |s| Box :: new( s) as Box <dyn crate :: util:: Socket >) ;
433+
434+ let connector = crate :: util:: ConnectorService :: new( svc) ;
435+
427436 let db = crate :: local:: Database :: open_local_with_offline_writes(
437+ connector,
428438 path,
429439 flags,
430440 url,
Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ impl Database {
131131 #[ cfg( feature = "sync" ) ]
132132 #[ doc( hidden) ]
133133 pub async fn open_local_with_offline_writes (
134+ connector : crate :: util:: ConnectorService ,
134135 db_path : impl Into < String > ,
135136 flags : OpenFlags ,
136137 endpoint : String ,
@@ -144,6 +145,7 @@ impl Database {
144145 } ;
145146 let mut db = Database :: open ( & db_path, flags) ?;
146147 db. sync_ctx = Some ( tokio:: sync:: Mutex :: new ( SyncContext :: new (
148+ connector,
147149 endpoint,
148150 Some ( auth_token) ,
149151 ) ) ) ;
Original file line number Diff line number Diff line change 1- use crate :: Result ;
1+ use crate :: { util :: ConnectorService , Result } ;
22use bytes:: Bytes ;
3- use hyper:: { client :: HttpConnector , Body } ;
3+ use hyper:: Body ;
44
55const DEFAULT_MAX_RETRIES : usize = 5 ;
66
@@ -9,13 +9,13 @@ pub struct SyncContext {
99 auth_token : Option < String > ,
1010 max_retries : usize ,
1111 durable_frame_num : u32 ,
12- client : hyper:: Client < HttpConnector , Body > ,
12+ client : hyper:: Client < ConnectorService , Body > ,
1313}
1414
1515impl SyncContext {
16- pub fn new ( sync_url : String , auth_token : Option < String > ) -> Self {
16+ pub fn new ( connector : ConnectorService , sync_url : String , auth_token : Option < String > ) -> Self {
1717 // TODO(lucio): add custom connector + tls support here
18- let client = hyper:: client:: Client :: builder ( ) . build_http :: < hyper:: Body > ( ) ;
18+ let client = hyper:: client:: Client :: builder ( ) . build :: < _ , hyper:: Body > ( connector ) ;
1919
2020 Self {
2121 sync_url,
You can’t perform that action at this time.
0 commit comments