@@ -3,28 +3,22 @@ use std::{path::Path, sync::Arc};
33
44use iroh_net:: { Endpoint , NodeAddr , NodeId } ;
55use iroh_router:: Router ;
6- use tokio_util:: task:: AbortOnDropHandle ;
76
87use crate :: {
98 downloader:: Downloader ,
109 net_protocol:: Blobs ,
1110 provider:: { CustomEventSender , EventSender } ,
12- rpc:: {
13- client:: { blobs, tags} ,
14- proto:: RpcService ,
15- } ,
11+ rpc:: client:: blobs,
1612 util:: local_pool:: LocalPool ,
1713} ;
1814
19- type RpcClient = quic_rpc:: RpcClient < RpcService > ;
20-
2115/// An iroh node that just has the blobs transport
2216#[ derive( Debug ) ]
17+
2318pub struct Node {
2419 router : iroh_router:: Router ,
25- client : RpcClient ,
20+ client : blobs :: MemClient ,
2621 _local_pool : LocalPool ,
27- _rpc_task : AbortOnDropHandle < ( ) > ,
2822}
2923
3024/// An iroh node builder
@@ -80,15 +74,10 @@ impl<S: crate::store::Store> Builder<S> {
8074 let router = router. spawn ( ) . await ?;
8175
8276 // Setup RPC
83- let ( internal_rpc, controller) = quic_rpc:: transport:: flume:: channel ( 32 ) ;
84- let internal_rpc = quic_rpc:: RpcServer :: new ( internal_rpc) . boxed ( ) ;
85- let _rpc_task = internal_rpc
86- . spawn_accept_loop ( move |msg, chan| blobs. clone ( ) . handle_rpc_request ( msg, chan) ) ;
87- let client = quic_rpc:: RpcClient :: new ( controller) . boxed ( ) ;
77+ let client = blobs. client ( ) ;
8878 Ok ( Node {
8979 router,
9080 client,
91- _rpc_task,
9281 _local_pool : local_pool,
9382 } )
9483 }
@@ -136,12 +125,7 @@ impl Node {
136125 }
137126
138127 /// Returns an in-memory blobs client
139- pub fn blobs ( & self ) -> blobs:: Client {
140- blobs:: Client :: new ( self . client . clone ( ) )
141- }
142-
143- /// Returns an in-memory tags client
144- pub fn tags ( & self ) -> tags:: Client {
145- tags:: Client :: new ( self . client . clone ( ) )
128+ pub fn blobs ( & self ) -> & blobs:: MemClient {
129+ & self . client
146130 }
147131}
0 commit comments