Skip to content

Commit

Permalink
pin futures to fix Windows stack overflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils committed Sep 4, 2024
1 parent d9a4a83 commit c99bcb2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Unreleased: mitmproxy_rs next

- Speculative fix for stack overflows on Windows.

## 04 September 2024: mitmproxy_rs 0.8.0

Expand Down
4 changes: 2 additions & 2 deletions mitmproxy-rs/src/server/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ impl Server {

// spawn tasks
let mut tasks = JoinSet::new();
tasks.spawn(async move { packet_source_task.run().await });
tasks.spawn(async move { py_task.run().await });
tasks.spawn(Box::pin(async move { packet_source_task.run().await }));
tasks.spawn(Box::pin(async move { py_task.run().await }));

let (shutdown_done_tx, shutdown_done_rx) = broadcast::channel(1);
tokio::spawn(shutdown_task(tasks, shutdown_done_tx));
Expand Down
2 changes: 1 addition & 1 deletion src/network/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn add_network_layer(
transport_commands_rx,
shutdown,
)?;
let h = tokio::spawn(async move { task.run().await });
let h = tokio::spawn(Box::pin(async move { task.run().await }));
Ok((h, network_events_tx, network_commands_rx))
}

Expand Down

0 comments on commit c99bcb2

Please sign in to comment.