mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-10 07:08:05 -05:00
pass subscriber address when start gateway client
This commit is contained in:
@@ -34,7 +34,7 @@ async fn start(executor: Arc<Executor<'_>>, config: Arc<CashierdConfig>) -> Resu
|
||||
let wallet = Arc::new(CashierDb::new("cashier.db", config.password.clone())?);
|
||||
|
||||
debug!(target: "Client", "Creating gateway client");
|
||||
let mut gateway = GatewayClient::new(gateway_addr, slabstore)?;
|
||||
let mut gateway = GatewayClient::new(gateway_addr,"127.0.0.1:4444".parse()?, slabstore)?;
|
||||
|
||||
gateway.start().await?;
|
||||
|
||||
|
||||
@@ -182,10 +182,11 @@ pub struct GatewayClient {
|
||||
gateway_slabs_sub_s: async_channel::Sender<Slab>,
|
||||
gateway_slabs_sub_rv: GatewaySlabsSubscriber,
|
||||
is_running: bool,
|
||||
sub_addr: SocketAddr,
|
||||
}
|
||||
|
||||
impl GatewayClient {
|
||||
pub fn new(addr: SocketAddr, rocks: RocksColumn<columns::Slabs>) -> Result<Self> {
|
||||
pub fn new(addr: SocketAddr, sub_addr: SocketAddr, rocks: RocksColumn<columns::Slabs>) -> Result<Self> {
|
||||
let protocol = ReqProtocol::new(addr, String::from("GATEWAY CLIENT"));
|
||||
|
||||
let slabstore = SlabStore::new(rocks)?;
|
||||
@@ -198,6 +199,7 @@ impl GatewayClient {
|
||||
gateway_slabs_sub_s,
|
||||
gateway_slabs_sub_rv,
|
||||
is_running: false,
|
||||
sub_addr,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -287,10 +289,9 @@ impl GatewayClient {
|
||||
|
||||
pub async fn start_subscriber(
|
||||
&self,
|
||||
sub_addr: SocketAddr,
|
||||
executor: Arc<Executor<'_>>,
|
||||
) -> Result<GatewaySlabsSubscriber> {
|
||||
let mut subscriber = Subscriber::new(sub_addr, String::from("GATEWAY CLIENT"));
|
||||
let mut subscriber = Subscriber::new(self.sub_addr, String::from("GATEWAY CLIENT"));
|
||||
subscriber.start().await?;
|
||||
executor
|
||||
.spawn(Self::subscribe_loop(
|
||||
|
||||
Reference in New Issue
Block a user