@@ -81,35 +81,37 @@ impl DocsApi {
8181 . context ( "cannot listen on remote API" ) ?;
8282 let handler: Handler < DocsProtocol > = Arc :: new ( move |msg, _rx, tx| {
8383 let local = local. clone ( ) ;
84- Box :: pin ( match msg {
85- DocsProtocol :: Open ( msg) => local. send ( ( msg, tx) ) ,
86- DocsProtocol :: Close ( msg) => local. send ( ( msg, tx) ) ,
87- DocsProtocol :: Status ( msg) => local. send ( ( msg, tx) ) ,
88- DocsProtocol :: List ( msg) => local. send ( ( msg, tx) ) ,
89- DocsProtocol :: Create ( msg) => local. send ( ( msg, tx) ) ,
90- DocsProtocol :: Drop ( msg) => local. send ( ( msg, tx) ) ,
91- DocsProtocol :: Import ( msg) => local. send ( ( msg, tx) ) ,
92- DocsProtocol :: Set ( msg) => local. send ( ( msg, tx) ) ,
93- DocsProtocol :: SetHash ( msg) => local. send ( ( msg, tx) ) ,
94- DocsProtocol :: Get ( msg) => local. send ( ( msg, tx) ) ,
95- DocsProtocol :: GetExact ( msg) => local. send ( ( msg, tx) ) ,
96- // DocsProtocol::ImportFile(msg) => local.send((msg, tx)),
97- // DocsProtocol::ExportFile(msg) => local.send((msg, tx)),
98- DocsProtocol :: Del ( msg) => local. send ( ( msg, tx) ) ,
99- DocsProtocol :: StartSync ( msg) => local. send ( ( msg, tx) ) ,
100- DocsProtocol :: Leave ( msg) => local. send ( ( msg, tx) ) ,
101- DocsProtocol :: Share ( msg) => local. send ( ( msg, tx) ) ,
102- DocsProtocol :: Subscribe ( msg) => local. send ( ( msg, tx) ) ,
103- DocsProtocol :: GetDownloadPolicy ( msg) => local. send ( ( msg, tx) ) ,
104- DocsProtocol :: SetDownloadPolicy ( msg) => local. send ( ( msg, tx) ) ,
105- DocsProtocol :: GetSyncPeers ( msg) => local. send ( ( msg, tx) ) ,
106- DocsProtocol :: AuthorList ( msg) => local. send ( ( msg, tx) ) ,
107- DocsProtocol :: AuthorCreate ( msg) => local. send ( ( msg, tx) ) ,
108- DocsProtocol :: AuthorGetDefault ( msg) => local. send ( ( msg, tx) ) ,
109- DocsProtocol :: AuthorSetDefault ( msg) => local. send ( ( msg, tx) ) ,
110- DocsProtocol :: AuthorImport ( msg) => local. send ( ( msg, tx) ) ,
111- DocsProtocol :: AuthorExport ( msg) => local. send ( ( msg, tx) ) ,
112- DocsProtocol :: AuthorDelete ( msg) => local. send ( ( msg, tx) ) ,
84+ Box :: pin ( async move {
85+ match msg {
86+ DocsProtocol :: Open ( msg) => local. send ( ( msg, tx) ) . await ,
87+ DocsProtocol :: Close ( msg) => local. send ( ( msg, tx) ) . await ,
88+ DocsProtocol :: Status ( msg) => local. send ( ( msg, tx) ) . await ,
89+ DocsProtocol :: List ( msg) => local. send ( ( msg, tx) ) . await ,
90+ DocsProtocol :: Create ( msg) => local. send ( ( msg, tx) ) . await ,
91+ DocsProtocol :: Drop ( msg) => local. send ( ( msg, tx) ) . await ,
92+ DocsProtocol :: Import ( msg) => local. send ( ( msg, tx) ) . await ,
93+ DocsProtocol :: Set ( msg) => local. send ( ( msg, tx) ) . await ,
94+ DocsProtocol :: SetHash ( msg) => local. send ( ( msg, tx) ) . await ,
95+ DocsProtocol :: Get ( msg) => local. send ( ( msg, tx) ) . await ,
96+ DocsProtocol :: GetExact ( msg) => local. send ( ( msg, tx) ) . await ,
97+ // DocsProtocol::ImportFile(msg) => local.send((msg, tx)).await,
98+ // DocsProtocol::ExportFile(msg) => local.send((msg, tx)).await,
99+ DocsProtocol :: Del ( msg) => local. send ( ( msg, tx) ) . await ,
100+ DocsProtocol :: StartSync ( msg) => local. send ( ( msg, tx) ) . await ,
101+ DocsProtocol :: Leave ( msg) => local. send ( ( msg, tx) ) . await ,
102+ DocsProtocol :: Share ( msg) => local. send ( ( msg, tx) ) . await ,
103+ DocsProtocol :: Subscribe ( msg) => local. send ( ( msg, tx) ) . await ,
104+ DocsProtocol :: GetDownloadPolicy ( msg) => local. send ( ( msg, tx) ) . await ,
105+ DocsProtocol :: SetDownloadPolicy ( msg) => local. send ( ( msg, tx) ) . await ,
106+ DocsProtocol :: GetSyncPeers ( msg) => local. send ( ( msg, tx) ) . await ,
107+ DocsProtocol :: AuthorList ( msg) => local. send ( ( msg, tx) ) . await ,
108+ DocsProtocol :: AuthorCreate ( msg) => local. send ( ( msg, tx) ) . await ,
109+ DocsProtocol :: AuthorGetDefault ( msg) => local. send ( ( msg, tx) ) . await ,
110+ DocsProtocol :: AuthorSetDefault ( msg) => local. send ( ( msg, tx) ) . await ,
111+ DocsProtocol :: AuthorImport ( msg) => local. send ( ( msg, tx) ) . await ,
112+ DocsProtocol :: AuthorExport ( msg) => local. send ( ( msg, tx) ) . await ,
113+ DocsProtocol :: AuthorDelete ( msg) => local. send ( ( msg, tx) ) . await ,
114+ }
113115 } )
114116 } ) ;
115117 let join_handle = task:: spawn ( irpc:: rpc:: listen ( endpoint, handler) ) ;
@@ -634,7 +636,7 @@ impl Stream for ImportFileProgress {
634636 . take ( )
635637 . expect ( "AddProgressItem::Done may be emitted only once" ) ;
636638 let size = size. expect ( "Size must be emitted before done" ) ;
637- let hash = * tag. hash ( ) ;
639+ let hash = tag. hash ( ) ;
638640 * this = Self ( ImportInner :: Entry ( Box :: pin ( async move {
639641 doc. set_hash ( author, key. clone ( ) , hash, size) . await ?;
640642 Ok ( ImportFileOutcome { hash, size, key } )
0 commit comments