fix(android): recover from input stream failures

This commit is contained in:
Edison Jwa
2026-05-20 14:52:34 +09:00
parent bc1bd89424
commit b65cedfa95
2 changed files with 47 additions and 11 deletions
+10 -2
View File
@@ -459,10 +459,18 @@ pub async fn connect(
identity: None,
ready_timeout: Duration::from_secs(15),
};
let snap = runtime()
let snap = match runtime()
.spawn(async move { session().connect(cfg).await })
.await
.map_err(|e| task_join_error("connect", e))??;
.map_err(|e| task_join_error("connect", e))?
{
Ok(snap) => snap,
Err(chanora_core::CoreError::AlreadyConnected) => runtime()
.spawn(async { session().snapshot().await })
.await
.map_err(|e| task_join_error("connect.snapshot", e))??,
Err(e) => return Err(e.into()),
};
Ok(snap.into())
}