Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit e6ca346

Browse files
committed
Fix build of wasmtime serve
1 parent 92d2ec4 commit e6ca346

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/commands/serve.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::time::{Duration, Instant};
1414
use tokio::io::{stderr, stdin, stdout};
1515
use tokio::sync::Notify;
1616
use wasmtime::component::{Component, Instance, InstancePre, Linker};
17-
use wasmtime::{AsContextMut, Engine, Store, StoreLimits, UpdateDeadline};
17+
use wasmtime::{Engine, Store, StoreLimits, UpdateDeadline};
1818
use wasmtime_wasi::p2::{IoView, StreamError, StreamResult, WasiCtx, WasiCtxBuilder, WasiView};
1919
use wasmtime_wasi_http::bindings as p2;
2020
use wasmtime_wasi_http::io::TokioIo;
@@ -980,17 +980,15 @@ async fn handle_request(
980980
.await
981981
})
982982
.await???;
983-
let (res, tx, io) =
984-
wasmtime_wasi_http::p3::Response::resource_into_http(&mut store, res)?;
983+
let (res, io) = wasmtime_wasi_http::p3::Response::resource_into_http(&mut store, res)?;
985984
tokio::task::spawn(async move {
986-
if let Some(io) = io {
987-
let closure = instance.run(&mut store, io).await?;
988-
closure(store.as_context_mut())?;
989-
}
990-
// TODO: Report transmit errors
991-
if let Some(tx) = tx {
992-
instance.run(&mut store, tx.write(Ok(()))).await?;
993-
}
985+
instance
986+
.run_with(&mut store, async |store| {
987+
// TODO: Report transmit errors
988+
let guest_io_result = async { Ok(()) };
989+
io.run(store, guest_io_result).await
990+
})
991+
.await??;
994992

995993
write_profile(&mut store);
996994
drop(epoch_thread);

0 commit comments

Comments
 (0)