Repository navigation
Conversation
5 of 13 tasks
altonen
reviewed
Apr 25, 2026
| router_event_loop(router, port_mapper, shutdown_rx).await; | ||
| std::process::exit(0); | ||
| }); | ||
| ui::native::RouterUi::start( |
Member
There was a problem hiding this comment.
After iced upgrade (#320), the native UI internally calls tokio::spawn() so a runtime must be active. With these changes alone the native UI is unable to start but with the patch below both UIs work:
diff --git a/emissary-cli/src/main.rs b/emissary-cli/src/main.rs
index 7d1eeb3..c4ef0db 100644
--- a/emissary-cli/src/main.rs
+++ b/emissary-cli/src/main.rs
@@ -55,8 +55,6 @@ mod tools;
mod tunnel;
mod ui;
-
-
/// Logging target for the file.
const LOG_TARGET: &str = "emissary";
@@ -474,10 +472,10 @@ fn main() -> anyhow::Result<()> {
}
#[cfg(all(feature = "native-ui", feature = "web-ui"))]
-fn main() -> anyhow::Result<()> {
- let runtime = tokio::runtime::Runtime::new()?;
+#[tokio::main]
+async fn main() -> anyhow::Result<()> {
let (shutdown_tx, shutdown_rx) = channel(1);
- let arguments = runtime.block_on(parse_arguments());
+ let arguments = parse_arguments().await;
let RouterContext {
router,
port_mapper,
@@ -488,30 +486,30 @@ fn main() -> anyhow::Result<()> {
address_book_handle,
router_id,
..
- } = runtime.block_on(setup_router::<TokioRuntime>(arguments))?;
+ } = setup_router::<TokioRuntime>(arguments).await?;
let use_web_ui = router_ui_config.as_ref().and_then(|c| c.web_ui).unwrap_or(false);
if use_web_ui {
match router_ui_config {
None => {
- runtime.block_on(router_event_loop(router, port_mapper, shutdown_rx));
+ router_event_loop(router, port_mapper, shutdown_rx).await;
}
Some(RouterUiConfig {
refresh_interval,
port,
..
}) => {
- runtime.spawn(async move {
+ tokio::spawn(async move {
ui::web::RouterUi::new(events, port, refresh_interval, shutdown_tx).run().await;
});
- runtime.block_on(router_event_loop(router, port_mapper, shutdown_rx));
+ router_event_loop(router, port_mapper, shutdown_rx).await;
}
}
} else {
match router_ui_config {
None => {
- runtime.block_on(router_event_loop(router, port_mapper, shutdown_rx));
+ router_event_loop(router, port_mapper, shutdown_rx).await;
}
Some(RouterUiConfig { .. }) => {
tokio::spawn(async move {
altonen
approved these changes
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Includes the fix mentioned in #344.