Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a535fd9

Browse files
authored
fix: don't panic on main pipe timeout, ref #1551 (#1699)
1 parent 222c63d commit a535fd9

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

.changes/android-timeout-crash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
wry: patch
3+
---
4+
5+
On Android, fixed panics on custom protocol timeouts. Increased timeout for non-internal requests to 30 seconds.

src/android/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,9 @@ impl InnerWebView {
279279
});
280280

281281
(custom_protocol_handler)(webview_id, request, RequestAsyncResponder { responder });
282-
return Some(rx.recv_timeout(MAIN_PIPE_TIMEOUT).unwrap());
282+
// 3x the timeout while we monitor https://github.com/tauri-apps/wry/issues/1551
283+
// TODO: Remove timeout
284+
return rx.recv_timeout(MAIN_PIPE_TIMEOUT * 3).inspect_err(|e| {eprintln!("custom protocol timed out: {e}");}).ok();
283285
}
284286
None
285287
},
@@ -493,7 +495,7 @@ pub fn platform_webview_version() -> Result<String> {
493495
}
494496
};
495497
MainPipe::send(activity_id, WebViewMessage::GetWebViewVersion(tx));
496-
rx.recv_timeout(MAIN_PIPE_TIMEOUT).unwrap()
498+
rx.recv_timeout(MAIN_PIPE_TIMEOUT)?
497499
}
498500

499501
/// Finds a class in the project scope.

0 commit comments

Comments
 (0)