@@ -6,7 +6,6 @@ use iroh_base::ticket::BlobTicket;
6
6
use iroh_blobs:: {
7
7
net_protocol:: Blobs ,
8
8
rpc:: client:: blobs:: { ReadAtLen , WrapOption } ,
9
- store:: mem,
10
9
util:: { local_pool:: LocalPool , SetTagOption } ,
11
10
} ;
12
11
@@ -23,20 +22,17 @@ async fn main() -> Result<()> {
23
22
// Now we build a router that accepts blobs connections & routes them
24
23
// to the blobs protocol.
25
24
let node = Router :: builder ( endpoint)
26
- . accept ( iroh_blobs:: ALPN , blobs)
25
+ . accept ( iroh_blobs:: ALPN , blobs. clone ( ) )
27
26
. spawn ( )
28
27
. await ?;
29
28
29
+ let blobs = blobs. client ( ) ;
30
+
30
31
let args = std:: env:: args ( ) . collect :: < Vec < _ > > ( ) ;
31
32
match & args. iter ( ) . map ( String :: as_str) . collect :: < Vec < _ > > ( ) [ ..] {
32
33
[ _cmd, "send" , path] => {
33
34
let abs_path = PathBuf :: from_str ( path) ?. canonicalize ( ) ?;
34
35
35
- let blobs = node
36
- . get_protocol :: < Blobs < mem:: Store > > ( iroh_blobs:: ALPN )
37
- . unwrap ( )
38
- . client ( ) ;
39
-
40
36
println ! ( "Analyzing file." ) ;
41
37
42
38
let blob = blobs
@@ -57,11 +53,6 @@ async fn main() -> Result<()> {
57
53
let path_buf = PathBuf :: from_str ( path) ?;
58
54
let ticket = BlobTicket :: from_str ( ticket) ?;
59
55
60
- let blobs = node
61
- . get_protocol :: < Blobs < mem:: Store > > ( iroh_blobs:: ALPN )
62
- . unwrap ( )
63
- . client ( ) ;
64
-
65
56
println ! ( "Starting download." ) ;
66
57
67
58
blobs
0 commit comments