Procházet zdrojové kódy

add is_running() function to gatewayclient to check if the connection is
started

ghassmo před 5 roky
rodič
revize
96f91b2749
1 změnil soubory, kde provedl 7 přidání a 1 odebrání
  1. 7 1
      src/service/gateway.rs

+ 7 - 1
src/service/gateway.rs

@@ -181,6 +181,7 @@ pub struct GatewayClient {
     slabstore: Arc<SlabStore>,
     slabstore: Arc<SlabStore>,
     gateway_slabs_sub_s: async_channel::Sender<Slab>,
     gateway_slabs_sub_s: async_channel::Sender<Slab>,
     gateway_slabs_sub_rv: GatewaySlabsSubscriber,
     gateway_slabs_sub_rv: GatewaySlabsSubscriber,
+    is_running: bool,
 }
 }
 
 
 impl GatewayClient {
 impl GatewayClient {
@@ -196,13 +197,14 @@ impl GatewayClient {
             slabstore,
             slabstore,
             gateway_slabs_sub_s,
             gateway_slabs_sub_s,
             gateway_slabs_sub_rv,
             gateway_slabs_sub_rv,
+            is_running: false,
         })
         })
     }
     }
 
 
     pub async fn start(&mut self) -> Result<()> {
     pub async fn start(&mut self) -> Result<()> {
         self.protocol.start().await?;
         self.protocol.start().await?;
         self.sync().await?;
         self.sync().await?;
-
+        self.is_running = true;
         Ok(())
         Ok(())
     }
     }
 
 
@@ -311,6 +313,10 @@ impl GatewayClient {
             slabstore.put(slab)?;
             slabstore.put(slab)?;
         }
         }
     }
     }
+
+    pub fn is_running(&self) -> bool {
+        self.is_running
+    }
 }
 }
 
 
 fn handle_error(status_code: u32) {
 fn handle_error(status_code: u32) {