@@ -6,7 +6,6 @@ use iroh_base::ticket::BlobTicket;
66use iroh_blobs:: {
77 net_protocol:: Blobs ,
88 rpc:: client:: blobs:: { ReadAtLen , WrapOption } ,
9- store:: mem,
109 util:: { local_pool:: LocalPool , SetTagOption } ,
1110} ;
1211
@@ -23,20 +22,17 @@ async fn main() -> Result<()> {
2322 // Now we build a router that accepts blobs connections & routes them
2423 // to the blobs protocol.
2524 let node = Router :: builder ( endpoint)
26- . accept ( iroh_blobs:: ALPN , blobs)
25+ . accept ( iroh_blobs:: ALPN , blobs. clone ( ) )
2726 . spawn ( )
2827 . await ?;
2928
29+ let blobs = blobs. client ( ) ;
30+
3031 let args = std:: env:: args ( ) . collect :: < Vec < _ > > ( ) ;
3132 match & args. iter ( ) . map ( String :: as_str) . collect :: < Vec < _ > > ( ) [ ..] {
3233 [ _cmd, "send" , path] => {
3334 let abs_path = PathBuf :: from_str ( path) ?. canonicalize ( ) ?;
3435
35- let blobs = node
36- . get_protocol :: < Blobs < mem:: Store > > ( iroh_blobs:: ALPN )
37- . unwrap ( )
38- . client ( ) ;
39-
4036 println ! ( "Analyzing file." ) ;
4137
4238 let blob = blobs
@@ -57,11 +53,6 @@ async fn main() -> Result<()> {
5753 let path_buf = PathBuf :: from_str ( path) ?;
5854 let ticket = BlobTicket :: from_str ( ticket) ?;
5955
60- let blobs = node
61- . get_protocol :: < Blobs < mem:: Store > > ( iroh_blobs:: ALPN )
62- . unwrap ( )
63- . client ( ) ;
64-
6556 println ! ( "Starting download." ) ;
6657
6758 blobs
0 commit comments