MCPcopy Create free account
hub / github.com/GCWing/BitFun / ensure_service

Function ensure_service

src/apps/desktop/src/api/remote_connect_api.rs:49–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47}
48
49async fn ensure_service() -> Result<(), String> {
50 let holder = get_service_holder();
51 let guard = holder.read().await;
52 if guard.is_some() {
53 return Ok(());
54 }
55 drop(guard);
56
57 let config = RemoteConnectConfig {
58 mobile_web_dir: detect_mobile_web_dir(),
59 ..RemoteConnectConfig::default()
60 };
61 let service =
62 RemoteConnectService::new(config).map_err(|e| format!("init remote connect: {e}"))?;
63 *holder.write().await = Some(service);
64
65 // Auto-restore previously paired bots
66 restore_saved_bots().await;
67
68 Ok(())
69}
70
71/// Restore any bot connections that were previously saved to disk.
72async fn restore_saved_bots() {

Callers 5

init_on_startupFunction · 0.85
remote_connect_startFunction · 0.85
remote_connect_statusFunction · 0.85

Calls 6

get_service_holderFunction · 0.85
detect_mobile_web_dirFunction · 0.85
restore_saved_botsFunction · 0.85
dropFunction · 0.50
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected