aramperes/onetun

stack overflow on windows

samhug opened this issue · 1 comments

When attempting to run this on windows I immediately get thread 'main' has overflowed its stack

I was able to get around this by heap allocating the wg.consume_task() future. With the below change I was able to forward a TCP port through a Wireguard tunnel

diff --git a/src/lib.rs b/src/lib.rs
index 57a3fc4..a43d657 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -53,7 +53,7 @@ pub async fn start_tunnels(config: Config, bus: Bus) -> anyhow::Result<()> {
     {
         // Start consumption task for WireGuard
         let wg = wg.clone();
-        tokio::spawn(async move { wg.consume_task().await });
+        tokio::spawn(Box::pin(async move { wg.consume_task().await }));
     }
 
     {

Interesting! Could you open a pull-request with your change?